You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Judy Sowell <js...@avolent.com> on 2001/12/07 23:27:11 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: classpath question

Posted by T Master <tm...@iknowledgeinc.com>.
People would need to see your script
Especially where your path/classpath was being sent

and more information too.


----- Original Message -----
From: "Judy Sowell" <js...@avolent.com>
To: <an...@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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: classpath question

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Judy Sowell" <js...@avolent.com>
To: <an...@jakarta.apache.org>
Sent: Friday, December 07, 2001 2: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.

I dont think you should put source files on the classpath for <javac>, just
binary stuff

If you want to include source from more than one source tree into a javac,
use the <src> nested element.

-Steve


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: classpath question

Posted by Ylan Segal <yl...@digiworks.tv>.
> 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.

Here is part of my build file... classpath is working great for me.

...
<path id="project.classpath">
	<pathelement path="${classpath}"/><!-- system classpath... in my case it's
empty -->
	<fileset dir="${lib.home}">
		<include name="**/*.jar"/><!-- This are external jar files -->
	</fileset>
	<pathelement location="${src.home}"/> <!-- src.home points to the directory
under 				which all my java files are arranged in directories according to
			standard package naming -->
</path>

	<!-- this is the portion that compiles the sources -->
	<javac
		srcdir="${src.home}"
		destdir="${compile.to}\"
		debug="on"
		 >
		<classpath refid="project.classpath"/>
	</javac>
...

Hope this example helps. Otherwise I would suggest posting the appropiate
parts of your buils file and I'll take a look and see what is going on.
You should note that the path element is not under a target, but declared
before any target so that it can be reused in other parts. The javac part IS
declared inside a target.

Good Luck.

Ylan Segal.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>