English
# Add dependency on artifact with org="com.example" and
# name="foobar" to ./submodule/ivy.xml
%pom_add_dep com.example:foobar submodule
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`
Ant
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.
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.
A subset of macros used to modify Maven POMs also work with `ivy.xml` files allowing the maintainer to add/remove/change dependencies without the need of making patches and rebasing them with each change. You can use dependency handling macros `%pom_add_dep`, `%pom_remove_dep`, `%pom_change_dep` and generic `%pom_xpath_*` macros. For more details, see corresponding manpages.
%build
ant -Divy.mode=local test publish-local
BuildRequires: ant
BuildRequires: javapackages-local
...
%build
ant test
BuildRequires: ivy-local
...
%build
ant -Divy.mode=local test
BuildRequires: ivy-local
....
%prep
%pom_xpath_set ivy:publish/@resolver xmvn build.xml
`%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
Common spec file
Details:
`-Divy.mode=local` tells Ivy to use XMvn local artifact resolution instead of downloading from the Internet
%files -f .mfiles
%dir %{_javadir}/%{name}
%files -f .mfiles
%files -javadoc -f .mfiles-javadoc
%files javadoc -f .mfiles-javadoc
If there is an `ivy-settings.xml` or similar file, which specifies remote repositories, it needs to be disabled, otherwise it would override local resolution.