ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Judy Sowell <jsow...@avolent.com>
Subject RE: classpath question
Date Sat, 08 Dec 2001 00:13:00 GMT
We have some source files which have cross dependencies. For instance at
some top level there are the following two directories:

d:/mydir/subdir/java/com/av/dataobjects/*.java
d:/mydir/subdir/java/com/av/testrunner/utils/DB*.java

Some class or classes under dataobjects rely on some DB class under
testrunner/utils. So, we added to our classpath the actual path down to the
java dir, as in d:/mydir/subdir/java. If we remove all previously built
classes and rebuild using javac (not with Ant), it works. In other words, if
we are building something under dataobjects, even if it imports
DBsomething.java which has not been built yet, it will build the dependency
because of the classpath.

But if we run Ant from an ant.bat file specifying -classpath after adding
our d:/mdir/subdir/java to the classpath, we get a build error because an
import not found (one of the DB classes). The DB class is not getting built
as it would outside of Ant.

We also tried setting a property with our classpath and adding that to the
target which does the compile. That gave us the same error.

What *does* work with Ant is to do this, by using the the includes rather
than relying on the classpath pointing to the java directory.
 
 <target name="dataobjects">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"
includes="**/dataobjects/*.java 	**/testrunner/utils/DB*.java"/>
 </target>

We can live with this, but I am curious why using -classpath pointing to the
java directory doesn't work.


-----Original Message-----
From: T Master [mailto:tmaster@iknowledgeinc.com]
Sent: Friday, December 07, 2001 3:19 PM
To: Ant Users List
Subject: Re: classpath question


People would need to see your script
Especially where your path/classpath was being sent

and more information too.


----- Original Message -----
From: "Judy Sowell" <jsowell@avolent.com>
To: <ant-user@jakarta.apache.org>
Sent: Friday, December 07, 2001 3:27 PM
Subject: classpath question


> Hi all,
>
> We have tried several things to get Ant to allow us to add java source
files
> to the classpath, but have been unsuccessful in getting it to work.
>
> When we do a build outside of ant, just using "javac -classpath ....."
where
> classpath includes some java source directories (because of cross
> dependencies between some classes/packages), it works fine.
>
> However, if instead we run ant with -classpath (the same classpath with
some
> java source dirs), the compile fails on an import on one of the
dependencies
> on one of the source files in the classpath. We also tried setting the
> classpath inside the build.xml file. That didn't work either.
>
> We did work around this by both changing the ordering of targets and by
> using includes. But we are wondering why the above (which works with javac
> outside of Ant) doesn't seem to work. Or are we doing something
incorrectly?
>
> Thanks for any advice,
> Judy
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
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