ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ventimiglia, David" <>
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:


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

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

  <target name="init">
       .... 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}"/>

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

  <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 id="project.class.path">
    <path refid="java.class.path"/>
    <path refid="weblogic.class.path"/>
    <fileset dir="classes">
      <include name="**/*.jar"/>
    <fileset dir="lib">
      <include name="**/*.jar"/>

  <target name="classes" depends="init">
    <javac srcdir="${src}"
        <path refid="project.class.path"/>

  .... some other targets ....


-----Original Message-----
From: Dave Inskeep []
Sent: Tuesday, October 24, 2000 8:54 AM
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 

[javac] Compilation args: jikes -d C:\Projects\beast\classes -classpath 

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


View raw message