tags:

views:

261

answers:

2

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 works 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?

A: 

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).

Pascal Thivent
Thanks! I've looked at the bash scripts driving ant, and the trailing slash in my ANT_HOME seems to be the reason for it working in that case. It does not work if ANT_HOME=/usr/share/ant
Ophidian
Ohoh. So setting `ANT_HOME` to `/usr/share/ant/` in `/etc/ant.conf` would solve this?
Pascal Thivent
For the most part it seems to. There's some sort of wrong matching in the bash scripts that handle Ant's initialization on Linux
Ophidian
A: 

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

Hannes Korte