Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other.
Apache Ant is probably second most used Java build tool right after Apache Maven. The main difference between these two tools is that Ant is procedural and Maven is declarative. When using Ant, it is neccessary to exactly describe the processes which lead to the result. It means that one needs to specify where the source files are, what needs to be done and when it needs to be done. On the other hand, Maven relies on conventions and doesn't require specifying most of the process unless you need to override the defaults.
If upstream ships a Maven POM file, it must be installed even if you don't build with Maven. If not you should try to search Maven Central Repository for it, ship it as another source and install it.
Common spec file
BuildRequires: ant
BuildRequires: javapackages-local
ant test
%mvn_artifact pom.xml lib/%{name}.jar
%mvn_install -J api/
%files -f .mfiles
%dir %{_javadir}/%{name}
%files javadoc -f .mfiles-javadoc
`%build` section uses `ant` command to build the project and run the tests. The used target(s) may vary depending on the `build.xml` file. You can use `ant -p` command to list the project info or manually look for `<target>` nodes in the `build.xml` file
`%mvn_artifact` macro is used to request installation of an artifact that was not built using Maven. It expects a POM file and a JAR file. For POM only artifacts, the JAR part is omitted. + See xref:mvn_macros.adoc#mvn_artifact[Installing additional artifacts] for more information
`%mvn_install` performs the actual installation. Optional `-J` parameter requests installation of generated Javadoc from given directory
This method of artifact installation allows using other XMvn macros such as `%mvn_alias` or `%mvn_package`
`%mvn_install` generates `.mfiles` file which should be used to populate `%files` section with `-f` switch. For each subpackage there would be separate generated file named `.mfiles-subpackage-name`
All packages are required to own directories which they create (and which are not owned by other packages). JAR files are by default installed into subdirectory of `%{_javadir}`. To override this behavior, use `%mvn_file`
Apache Ivy
Apache Ivy provides an automatic dependency management for Ant managed builds. It uses Maven repositories for retrieving artifacts and supports many declarative features of Maven such as handling transitive dependencies.
XMvn supports local resolution of Ivy artifacts, their installation and requires generation.