ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Cross <>
Subject Javac and classpath
Date Thu, 21 Feb 2002 17:12:17 GMT


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}"
         <include name="${JAVA.COMPILE_TARGET}/*.java"/>
            <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"/>

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 ) {
        } else {
            if ( includeAntRuntime ) {
            } else {

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,


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message