Reputation: 3432
I have my single dependency on path projectRoot/lib/jsoup.jar
.
My build.xml is simple:
<project name="Ant-Demo" default="main" basedir=".">
<property name="src.dir" value="src" />
<property name="build.dir" value="buildDirectory" />
<property name="dist.dir" value="dist" />
<property name="docs.dir" value="docs" />
<property name="lib.dir" value="lib" />
<path id="build.classpath">
<pathelement location="lib/jsoup-1.7.3.jar"/>
</path>
<target name="compile" depends="clean,makedir">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" />
</target>
<target name="jar" depends="compile">
<jar destfile="${dist.dir}/AntDemo,jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="ant.test" />
</manifest>
</jar>
</target>
...........................................
This doesn't work, because jsoup.jar is not included in final AntDemo.jar.
EDIT When compile target is running the output has warning:
compile:
[javac] D:\Software\es_ws\AntDemo\build.xml:30: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to D:\Software\es_ws\AntDemo\buildDirectory
What does this warning mean?
Thank you!
Upvotes: 0
Views: 3772
Reputation: 507
If you need that the content of jsoup.jar is included on your AntDemo.jar you can do it on several ways. My suggestion is use this solution:
<jar destfile="${dist.dir}/AntDemo.jar" >
<manifest>
<attribute name="Main-Class" value="ant.test" />
</manifest>
<fileset dir="${build.dir}" />
<zipfileset includes="**/*.class" src="lib/jsoup-1.7.3.jar" />
</jar>
Upvotes: 2
Reputation: 279960
When you compile classes and specify a classpath, the classes and other resources in that javac
classpath don't get copied over to the destination, in ant or in typical command line javac
. You need to copy them over manually, or in ant with a copy
or other means.
Upvotes: 1