Discussion:
Question about j2seproject3:javac task
Giampaolo Melis
20 years ago
Permalink
Hi,
I would like to modify the build.xml file in my project, customizing
the files to be compiled (see Issue 65510, I'm waiting for the
enhancement).
I've tried overriding the -do-compile target as follows:

<target name="-do-compile"
depends="init,deps-jar,-pre-pre-compile,-pre-compile"
if="have.sources">
<echo message="${build.classes.dir}"/>
<echo message="${src.lib.dir}"/>
<echo message="${build.classes.excludes}"/>
<j2seproject3:javac>
<customize>
<exclude name="${src.lib.dir}/client/**"/> <!--
Hardcoded for the moment -->
<exclude name="${src.lib.dir}/daos/**"/>
<exclude name="**/CmpDaoImplDefault_ok.java"/>
</customize>
</j2seproject3:javac>
<copy todir="${build.classes.dir}">
<fileset dir="${src.lib.dir}" excludes="${build.classes.excludes}"/>
</copy>
</target>

Somebody knows what sub elements can be used in j2seproject3:javac
customize element? (exclude does not work!)

Thanks
Giampaolo Melis
20 years ago
Permalink
OK, I've found the macrodef task for j2seproject3:javac.
The error was in the absolute paths specified by the exclude elements.
If someone has the same problem here is the correct version:

<target name="-do-compile"
depends="init,deps-jar,-pre-pre-compile,-pre-compile"
if="have.sources">
<echo message="${build.classes.dir}"/>
<echo message="${src.lib.dir}"/>
<echo message="${build.classes.excludes}"/>
<property name="build.sources.excludes"
value="client/**,daos/**,**/CmpDaoImplDefault_ok.java"/>
<property name="build.package.base"
value="com/marconi/nms2k/nps/base/lib"/>
<j2seproject3:javac>
<customize>
<patternset excludes="${build.sources.excludes}"/>
</customize>
</j2seproject3:javac>
<copy todir="${build.classes.dir}/${build.package.base}"
includeEmptyDirs="false">
<fileset dir="${src.lib.dir}"
excludes="${build.classes.excludes},${build.sources.excludes}"/>
</copy>
</target>

I've used the property 'build.sources.excludes' for packages/files
exclusion. In the final
solution I will read the exclusion list from a configuration file
saved in my project directory.
I've also used a 'base package' property (build.package.base) for
copying resources in the
proper path (see copy task element).
...
Loading...