tags:

views:

5

answers:

0

I have an ant build.xml. I want it to be generic, in the sense that it should not be dependent on ivy with respect to setting the classpath.

This is one of my targets in my build.xml

<path id="classpath">
<fileset dir="${lib-dir}">
    <include name="**/*.jar" />
</fileset>
</path>

<target name="compile-test-classes" depends="compile-src-classes, init-test, ivy-retrieve-test" description="Compile test files">
<javac srcdir="${test-src-dir}" destdir="${test-classes-dir}">
    <classpath refid="ivy.classpath"/>
</javac>
<echo>compilation complete!</echo>
</target>

Currently it will fail, if the user decides not to use ivy as it depends on ivy-retrieve-test to set the ivy.classpath.

How do i get this target to use the ivy.classpath if ivy is used else get the regular classpath. I want to write it in a generic fashion such that an import at the top of the build file will make the switch rather than writing if than else statements.