ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject RE: newbie - dependency question
Date Mon, 31 Jul 2000 05:30:09 GMT
Joel,

Put your source in a tree that corresponds to its package name
./com/jnana/alert/AlermMain.java, etc

This has two advantages
ant will work correctly
javac, the compiler, will work correctly

ant will work because it can match up the destination class files and the
source java files to see if it needs to do a compile. The ant javac task
does not parse the input java files to figure out the corresponding class
files.

javac, the compiler, not the task, can figure out the source file needed to
satisfy a missing class file if that source file is in the correct location
in the package space.

For these two reasons it is stringly recommended that you set up your source
directory structure to match your package structure. Take a look at the ant
source code itself to see what I mean.

Conor


--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au

> -----Original Message-----
> From: Joel Riedesel [mailto:jriedese@jnana.com]
> Sent: Monday, 31 July 2000 6:03
> To: ant-user@jakarta.apache.org
> Subject: newbie - dependency question
>
>
>
> We've got a fairly straightforward build process where
> optional modules are all in their own directories (and
> own java packages).
>
> So, in one module, I might have a build target like this
> (forgive me if I'm being verbose):
>   <target name="dev">
>
>     <javac srcdir="."
>            destdir="${codebase}"
>            classpath="${classpath}">
>       <include name="AlertMain.java"/>
>       <include name="Alert.java"/>
>       <include name="ActionEvent.java"/>
>       <include name="AlertFireEvent.java"/>
>       <include name="AlertData.java"/>
>       <include name="RemoteAlertData.java"/>
>       <include name="LAlert.java"/>
>       <include name="AlertEditor.java"/>
>       <include name="AlertSetNode.java"/>
>       <include name="AlertNode.java"/>
>     </javac>
>
>     <copydir src="." dest="${codebase}/com/jnana/alert"
>              includes="*.gif,alerts.xml"/>
>
>   </target>
>
>
> This happens to be in the java package:  com.jnana.alert
> And my codebase is then some path:  c:\foo\codebase
> Thus, when java compiles Alert.java, it gets compiled to
> c:\foo\codebase\com\jnana\alert\Alert.class
> since I am using a different dest dir than source dir.
>
> But, everytime I run Ant from this directory, it recompiles
> everything; obviously because it doesn't find Alert.class directly
> in the destination directory - it doesn't seem to use the
> necessary java package name to know this.
>
> I'm sure there must be a way to do this right, and I probably
> just don't know what it is.
>
> Would anyone please suggest how to do this?
>
> Thanks,
>
> Joel
>
>
> --
> Joel Riedesel
> Jnana Technologies Corporation
> mailto:jriedese@jnana.com
>


Mime
View raw message