ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Moynihan <r...@calicojack.co.uk>
Subject javac/javadoc with a common fileset for source files
Date Thu, 30 Aug 2007 12:28:21 GMT
Hi all,

I'm just wondering if it's possible to have the javac & javadoc tasks 
share a common fileset.

I have a series of builds with more than one source directory.  I would 
ideally like a mechanism to specify the directories/files for both of 
these once and reuse that definition in both the javadoc and javac tasks.

We have quite a complex build where we import a base ant file which we 
override selectively depending on the build.  What I'd like to do is 
specify once in base.xml something like (abbreviated):

     <!-- override src.dirs in top level build when we want multiple 
directories etc... -->
     <fileset dir="${src.dir}" id="src.dirs">
       <include name="**/*.java"/>
     </fileset>

     <target name="build">
         <javac...>
           <fileset refid="src.dirs"/> <!-- problem -->
           <classpath refid="build.classpath"/>
         </javac>
     </target>

     <target name="java-doc">
         <javadoc...>
           <classpath refid="build.classpath"/>
           <fileset refid="src.dirs"/> <!-- works ok -->
         </javadoc>
     </target>

Unfortunately the above doesn't work as javac won't accept a fileset in 
order to specify it's source directories (where as javadoc does). 
Ideally I'd like to keep things DRY and not have to resort to 
duplicating the specification of my src directories.  Is this possible?

Thanks in advance,

R.

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


Mime
View raw message