Description of problem: When I tried to use ant for downloading ivy in a project, it downloads ivy in `$HOME/.ant/lib/ivy.jar` (the usual location). But the problem is, `ant` could not detect the library. The output says: > This appears to be an antlib declaration. > Action: Check that the implementing library exists in one of: > -/usr/share/ant/lib > -/home/dsupriadi/.ant/lib > -a directory added on the command line with the -lib argument Trying to move ivy.jar in `/usr/share/ant/lib` or run ant with -lib didn't do anything and the output is still the same. Version-Release number of selected component (if applicable): 1.10.11-2.f35 How reproducible: always Steps to Reproduce: 1. download/put ivy.jar at $HOME/.ant/lib 2. run ant in java project that contains ivy.xml Actual results: BUILD FAILED /home/dsupriadi/Fork/project/build.xml:67: Problem: failed to create task or type antlib:org.apache.ivy.ant:cachepath Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any <presetdef>/<macrodef> declarations have taken place. No types or tasks have been defined in this namespace yet This appears to be an antlib declaration. Action: Check that the implementing library exists in one of: -/usr/share/ant/lib -/home/dsupriadi/.ant/lib -a directory added on the command line with the -lib argument Total time: 1 second Expected results: (it runs successfully)
Running `java -cp $(build-classpath ant/ant-launcher) org.apache.tools.ant.launch.Launcher` solves my problem. But now I'm confused, why `java -cp $(build-classpath ant/ant ant/ant-launcher) org.apache.tools.ant.launch.Launcher` doesn't work? I tried it with upstream jars, but the error is the same.
This is not a bug in Ant. When Ant is launched in "RPM mode" (which is default for Ant packaged for Fedora) then the mechanism of loading JARs from $HOME/.ant/lib is not used - ant JARs are loaded from /usr/share/ant/lib and extension JARs (such as third-party tasks) are loaded from standard directories (such as /usr/share/java and /usr/lib/java) according to configuration files in /etc/ant.d/. This is intentional. To disable "RPM mode" of launching Ant you can set rpm_mode=false in one of Ant configuration files (globally in /etc/ant.conf, or per-user in $HOME/.ant/ant.conf). Another possibility is running Ant with --noconfig option. References: Upstream bug: https://bz.apache.org/bugzilla/show_bug.cgi?id=44849 Related RHEL 5 bug: https://bugzilla.redhat.com/show_bug.cgi?id=443523