In a project we have several source paths, so we defined a reference path for them:
<path id="de.his.path.srcpath">
<pathelement path="${de.his.dir.src.qis.java}"/>
<pathelement path="${de.his.dir.src.h1.java}"/>
...
</path>
Using the reference works fine in the <javac> tag:
<src refid="de.his.path.srcpath" />
In the next step, we have to copy non-java files to the classpath folder:
<copy todir="${de.his.dir.bin.classes}" overwrite="true">
<fileset refid="de.his.path.srcpath">
<exclude name="**/*.java" />
</fileset>
</copy>
Unfortunately, this does not work because "refid" and nested elements may not be mixed.
Is there a way I can get a set of all non-java files in my source path without copying the list of source paths into individual filesets?
Best Answer
Here's an option. First, use the pathconvert task to make a pattern suitable for generating a fileset:
Next make the fileset from all the files in the paths, except the java sources. Note the trailing wildcard
/**/*
needed as pathconvert only does the wildcards within the list, not the one needed at the end:Then your copy task would be:
For portability, instead of hard-coding the unix wildcard
/**/*
you might consider using something like: