Hello!

I want to use a <patternset> in a <javac> task.

The ant manual says on the <javac> page:
"This task forms an implicit FileSet and supports all attributes of 
<fileset> (dir becomes srcdir) as well as the nested <include>, 
<exclude> and <patternset> elements."

And the DTD says that it is possible, too, but I can't find the right 
syntax.

My aim is to use the same patternset with javac and copy, so that I 
needn't list the directories two times. (The patternset contains the 
directories whose *.java files should be compiled and whose resources 
should be copied. Other files shouldn't be copied and all other 
direcotries shouldn't be regared.)

I've tried different approaches the following code is one:

<mapper id="resources" type="regexp" 
from="^((.+)\.gif)|((.+)\.jpeg)|((.+)\.jpg)|((.+)\.properties)$$" to="\0"/>

<patternset id="ps-ep-resource" >
    <include name="*"/>
    <include name="images\*"/>
    <include name="images\small\*"/>
    <include name="images\tiny\*"/>
</patternset>

<target name="ep-resource">
    <javac
        destdir="${PRJ_CLASSES}"
        classpath="${myenv.CLASSPATH}"
        debug="on"
        deprecation="off"
        failonerror="on"
    >
        <!-- scr or scrdir is missing here -->
        <patternset refid="ps-ep-resource"/>
    </javac>
    <copy todir="${PRJ_CLASSES}/com/epag/resource" includeEmptyDirs="no">
        <mapper refid="resources"/>
        <fileset dir="${PRJ_SOURCE}/com/epag/resource">
            <patternset refid="ps-ep-resource"/>
        </fileset>
    </copy>
</target>

Can you give me a hint, please?

Thank you!

Steffen

Reply via email to