Hi,
I have been having a bit of a problem with the javac task.
The sun javac compiler states that if the '-d' flag is used the
directory is not added to the classpath. The ant javac task makes no
mention of whether this happens when specifying a destdir so I assumed
that it didn't and wrote my XML as follows:
<javac srcdir="${JAVA.ROOT_DIR}" destdir="${JAVA.CLASS_DIR}"
debug="${JAVA.DEBUG}">
<include name="${JAVA.COMPILE_TARGET}/*.java"/>
<classpath>
<pathelement path="${JAVA.AUX_DIR}"/>
<pathelement path="${JAVA.GENCLASS_DIR}"/>
<pathelement path="${JAVA.CLASS_DIR}"/>
<pathelement path="${java.class.path}"/>
<fileset dir="${JAVA.JARS_DIR}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
The problem was that the classpath produced by the ant task is not as I
have specified above. It appears that DefaultCompilerAdapter
automatically adds the dest dir to the classpath. While this is no bad
thing (apart from not being documented :-) ) it would be better if it
added it after the
if (compileClasspath == null) {
if ( includeAntRuntime ) {
classpath.addExisting(Path.systemClasspath);
}
} else {
if ( includeAntRuntime ) {
classpath.addExisting(compileClasspath.concatSystemClasspath("last"));
} else {
classpath.addExisting(compileClasspath.concatSystemClasspath("ignore"));
}
}
block as then this would allow the build file writer to exactly specify
the classpath. If the build file writer hasn't specified a classpath the
destdir still gets added.
Would anyone who has knowledge of the code care to comment?
Thanks very much,
Nick
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>