ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Allan <ste...@wrq.com>
Subject Best practice for numerous javac calls?
Date Mon, 02 Dec 2002 18:29:03 GMT
Hi,

I hava a java project where all the different components are under one
source root.  To accommodate the developers' request to be able to
build certain subsections of the code and their dependencies, there
are 10 different compile targets.  To avoid duplicating all the
<javac> calls, I wrote a single compile-java target with the idea that
a component's compile target could define the java source and classpath, and
then call the java-compile target.  Here's a typical example:

<target name = "utils" depends = "init">
 <!-- define classpath -->
 <path id = "compile.classpath">
   <pathelement location = "${jaas.jar}"/>
 </path>

 <!-- define source patternset -->
 <patternset id = "java.src">
   <include name = "${my.package.root}/util/**/*.java"/>
   <include name = "${my.package.root}/include/**/*.java"/>
 </patternset>

 <!-- compile classes -->
 <antcall target = "java-compile" inheritrefs = "true"/>
</target>

And the java-compile target looks like this:

<target name = "java-compile">
  <javac destdir     = "${build.classes.dir}"
         srcdir      = "${src.dir}"
	 ...
	 >
     <classpath refid = "compile.classpath"/>
     <patternset refid = "java.src"/>
  </javac>
</target>


This works, but if I build all my components in one call to ant, I
keep getting messages about redefining references:

Overriding previous definition of reference to compile.classpath
Overriding previous definition of reference to java.src

So I'm wondering

1) Is redefining a reference a 'bad thing'?
2) Is there a better way to achieve this type of granularity in the
   compile targets?

Thanks.

-- Steve
// WRQ has 21 years of experience providing integration software and
// services for host-intensive environments. To learn more about our
// Reflection and Verastream products, visit http://www.wrq.com/products/


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