ant-user mailing list archives

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


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:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message