Reputation: 6524
Is there a way to set the value of the javac
classpath
property in Apache Ant (v1.9.6) so that I don't have to literally specify all the jars that I want to include e.g. a directory or file glob.
So, if I have something like:
<javac classpath="./lib/one.jar":./lib/two.jar:./lib/three.jar..."
...is there anyway to just specify my ./lib
directory once, like the way you can do when you run a java application like:
java -cp ./lib/'*'
I've tried that, and just using ./lib
, or./lib/*
or ./lib/*.jar
but they don't work.
Upvotes: 0
Views: 246
Reputation: 78011
And another solution using a reusable classpath reference:
<path id="compile.path">
<fileset dir="lib" includes="*.jar"/>
</path>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false" debug="true" classpathref="compile.path"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="compile.path"/>
<pathelement path="${classes.dir}"/>
</classpath>
..
..
Upvotes: 1
Reputation: 7051
Try putting a <classpath>
element under <javac>
:
<javac ...>
<classpath>
<fileset dir="lib" includes="*.jar"/>
</classpath>
</javac>
Upvotes: 1