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 Thu, 02 Nov 2000 16:07:16 GMT
Steve:

I'm not sure this addresses your problem, but then hope springs eternal, so:
try putting your <property> elements inside <project>, outside of any <task>
(such as an "init" task).  They will get evaluated before your <path>
elements are evaluated (or should be at least...they do for me!).
Apparently, <property> is allowed to live outside of <target>, inside
<project>.

Cheers,
David

-----Original Message-----
From: Steve Collins [mailto:steve.collins@ifactor-e.com]
Sent: Thursday, November 02, 2000 8:09 AM
To: ant-user@jakarta.apache.org
Subject: Re: javac task and classpath attribute


Diane Holt wrote:

> It looks like you're referencing the WL_HOME property in the <path> tasks
> before you've set it, via the "init" target, which doesn't get run until
> the target that depends on it is run. The <path> tasks, however, being
> outside of any target, will I believe, be "run" at parse-time. If you put
> those inside the "init" target, after the properties are set, it should
> work.

If you try to put the <path> task inside of a <target> I get:
-----------------------------------------------------------
BUILD FAILED

/home/scollins/development/Timecard/build.xml:102: Could not create task of
type: path because I can't find it in the list of task class definitions.
Common solutions are: 1 execute bin/bootstrap. 2 use taskdef to declare your
task. 3 add the task to defaults.properties.
-----------------------------------------------------------
I don't get this error if the <path> task is outside of the <target> task.

I'm having the same problem as David but the solution doesn't work because
it appears that the <path> task works fine outside of a <target> task but
not
if I put the <path> task
inside of a <target> to resolve the problem where the properties that are
not
yet set when the path is being evaluated.
Thanks, Steve

> If you need the <path> tasks done without having any targets that
> reference them depend on "init", then you'd need to set the properties
> that are currently being set in "init" be set, instead, outside of a
> specific target.
>
> Diane
>
> --- "Ventimiglia, David" <David.Ventimiglia@msdw.com> wrote:
> > 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
>
> =====
> (holtdl@yahoo.com)
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf!  It's FREE.
> http://im.yahoo.com/

Mime
View raw message