Ant: add a single compiled class file to javac classpath?

ant, classpath, java, javac

Solution

Builld a path refering your class file :

<path id="javac.classpath">
     <pathelement location="./gen/stragglers/SomePOJO.class"/>
</path>

Then use it within your javac task :

<javac srcdir="./src/main/java" destdir="./gen/bin/main">
    <classpath refid="javac.classpath"/>
</javac>

Problem

In Ant, if I have a lone compiled CLASS file located somewhere inside my project (say at `gen/stragglers/SomePOJO.class`, is there a way to specifically add that class file to my `<javac>` compile classpath, when I currently have the following: ``` <javac includeantruntime="false" srcdir="src/main/java" destdir="gen/bin/main"> <classpath refid="main.compile.path"/> </javac> ``` If not, why? If so, how? Thanks in advance!

Original source