Configuration: I'm running stock Fedora 12 with the ant that Fedora ships:
- ant-1.7.1-12.fc12
- java-1.6.0-openjdk-1.6.0.0-33.b16.fc12
I have svnant.jar
and svnClientAdapter.jar
in my $HOME/.ant/lib/
I'm using the following build.xml
:
<project name="antlibtest" default="doEcho">
<taskdef resource="svntask.properties"/>
<target name="doEcho">
<echo message="Hello World!"/>
<echo message="ANT_HOME=${ant.home}"/>
<echo message="classpath=${java.class.path}"/>
</target>
</project>
When the build file is executed, I get the following error: [taskdef] Could not load definitions from resource svntask.properties. It could not be found.
If I set ANT_HOME to /usr/share/ant/
it wo开发者_运维问答rks flawlessly.
In both cases, the jars from my home directory are clearly in the output of the classpath.
How do I make this work without resorting to my own copy of ant, ANT_HOME and ant --noconfig?
This seems to be the problem described in Bug 490542 (that applies to Fedora 12 too according to the last comment). Sadly, the bug is still in a NEW state so I don't think it will be solved in a near future.
Regarding ANT_HOME, doesn't /etc/ant.conf
set it to /usr/share/ant
as explained here? This may be outdated but I can't check it (and I don't really get how this should be setup on Fedora).
I just had the same problem with maven-ant-tasks.jar. Ant showed the jar file in the classpath but didn't find it in the tag. The change of ANT_HOME didn't work for me, but I found another solution:
The optional jar files have to be registered in a simple text file in /etc/ant.d containing the name (or path) of the jar file, where the path is relative to /usr/share/java and without the extension ".jar".
So if you want to register maven-ant-tasks for example, then simply put maven-ant-tasks.jar (or it's symlink) into /usr/share/java and add the file "maven-ant-tasks" to /etc/ant.d consisting of the line: "maven-ant-tasks".
That works at least for me on openSuse 11.1. Maybe this helps somebody.
Hannes
I get same issue on centos 7 google cloud build-in ant is 1.9.x I try to download newest ant 1.10.x but have same issue
Setting ANT_HOME
to /usr/share/ant/
also resolve it.
精彩评论