ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ventimiglia, David" <David.Ventimig...@msdw.com>
Subject RE: javac task and classpath attribute
Date Tue, 31 Oct 2000 01:38:43 GMT
It looks like elements only get added to the classpath if they exist.  For
instance, in Dave's example below, if "foo" doesn't refer to a real file or
directory off of the project base path, then he won't see it in the messages
emitted when he runs Ant.

In my case, it looks like property values aren't getting evaluated properly
by the time the classpath is evaluated, so the Javac task checks to see if
things like these exist:

${WL_HOME}\classes\boot
${WL_HOME}\eval\cloudscape\lib\cloudscape.jar

Where ${WL_HOME} is being treated literally, rather than having its value,
c:\weblogic, substituted.  Of course these paths don't exist, so it gets
left off the classpath, leading to compilation errors.  The only way I can
seem to get it to work is to either remove the property references, or to
set a system classpath (for example, by running $WL_HOME\setEnv.cmd) before
running Ant.

The question is, why aren't my properties being evaluated?  I must be
missing something fundamental.  Any ideas?  Here's a copy of my build.xml
file:

<project name="buildejb" default="ejb" basedir=".">

  <target name="init">
    <tstamp/>
       .... set some other properties ....
    <property name="JAVA_HOME" value="c:/jdk1.2.2"/>
    <property name="WL_HOME" value="c:/weblogic"/>
    <property name="MYSERVER" value="${WL_HOME}/myserver"/>
    <mkdir dir="${build}"/>
  </target>

  <path id="java.class.path">
    <pathelement path="${WL_HOME}/classes/boot"/>
    <pathelement location="${WL_HOME}/eval/cloudscape/lib/cloudscape.jar"/>
  </path>

  <path id="weblogic.class.path">
    <pathelement path="${WL_HOME}/license"/>
    <pathelement path="${WL_HOME}/classes"/>
    <pathelement path="${WL_HOME}/myserver/serverclasses"/>
    <pathelement location="${WL_HOME}/lib/weblogicaux.jar"/>
  </path>

  <path id="project.class.path">
    <path refid="java.class.path"/>
    <path refid="weblogic.class.path"/>
    <fileset dir="classes">
      <include name="**/*.jar"/>
    </fileset>
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <target name="classes" depends="init">
    <javac srcdir="${src}"
           destdir="${build}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="${deprecation}"
           includes="**/${package}/*.java"
           target="${target-vm}">
      <classpath>
        <path refid="project.class.path"/>
      </classpath>
    </javac>
  </target>

  .... some other targets ....

</project>

-----Original Message-----
From: Dave Inskeep [mailto:dave.inskeep@bea.com]
Sent: Tuesday, October 24, 2000 8:54 AM
To: ant-user@jakarta.apache.org
Subject: javac task and classpath attribute


Does anyone else have problems with using the classpath attribute, 
classpath nested element, or classpathref attribute with the javac task? No 
matter what I try, javac seems to ignore the classpath and use what ant ran 
with. In desperation I even just tried:

<javac srcdir="${src.dir}" destdir="${build.dir}" classpath="foo"/>

hoping to see my classpath as foo. However, this is what I get with "ant 
-verbose":

[javac] Compilation args: jikes -d C:\Projects\beast\classes -classpath 
"C:\Program 
Files\JavaSoft\JRE\1.2\lib\ext\iiimp.jar;C:\Projects\beast\classes;C:\java\a
nt\lib\ant.jar;C:\java\ant\lib\jaxp.jar;C:\java\ant\lib\parser.jar;C:\java\j
dk1.2.2\lib\tools.jar;C:\Program 
Files\JavaSoft\JRE\1.2\lib\rt.jar;C:\Projects\beast\src"

It appears to be just the classpath that the ant batch file uses plus my 
srcdir and destdir. Am I missing something obvious? I'm using version ant
1.2.

Thanks,
Dave

Mime
View raw message