1
votes

I am new to ant and java and I am struggling to incorporate the third party ant library awstasks into my ant build script.

I am able to get this jar to start to load if I copy it into the usr/share/ant/lib path, but it fails with the exception

A class needed by class dak.ant.taskdefs.S3Upload cannot be found: org/jets3t/service/S3ServiceException using the classloader AntClassLoader

I then downloaded the jets3t.jar file and put this in the ant/lib path, only for it to fail on another dependency. I knew this path of including the jar files in the ant/lib path could not be the correct way to handle these 3rd party plug-ins and their dependency.

I then did some research into using the paths to import the necessary jar files and have been trying to use those to resolve the dependency problem, but have been unsuccessful. The ant path declaration is as follows:

<path id="projet.classpath" description="The default classpath.">
    <pathelement path="../awsUpload/awstasks-read-only/lib/"/>
  <fileset dir="../awsUpload/awstasks-read-only/lib/">
    <include name="**/*.jar"/>
  </fileset>
</path>

I can see from the build output that it is loading the following jar files, which as far as I can tell should include the jets3t dependency it is failing on:

AntClassLoader[/Users/travis/workspace/Sudoko/build/lib:/Users/travis/workspace/Sudoko/build/lib/jets3t/jars/cockpit-0.8.0.jar:/Users/travis/workspace/Sudoko/build/lib/jets3t/jars/cockpitlite-0.8.0.jar:/Users/travis/workspace/Sudoko/build/lib/jets3t/jars/jets3t-0.8.0.jar:/Users/travis/workspace/Sudoko/build/lib/jets3t/jars/jets3t-gui-0.8.0.jar:/Users/travis/workspace/Sudoko/build/lib/jets3t/jars/synchronize-0.8.0.jar:/Users/travis/workspace/Sudoko/build/lib/jets3t/jars/uploader-0.8.0.jar]

I have also attempted to load the awstasks jar file using the path method without success.

I would really appreciate if someone could give me some guidance on where I am going wrong and what I should be doing.

1

1 Answers

0
votes

Ok, so I did some further reading and it seems to me that including the jar files in the ant/lib path is a valid approach. In fact this FAQ suggests to me that not all jar files can support the nested loading of dependencies using the classpath, as jUnit did not previously support this.

I would be interested to know if this is not the case.

For now I shall just be adding an ant task in to copy my third party libraries into the ant/lib path, and then delete them when the build completes.