Grokbase Groups Ant user July 2001
FAQ
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

Search Discussions

  • Stefan Bodewig at Jul 10, 2001 at 1:33 pm

    On Tue, 10 Jul 2001, Steffen Euch wrote:

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

    And the DTD says that it is possible, too, but I can't find the
    right syntax.
    you are close 8-)
    <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>
    Just add the src or srcdir there. If it is only one src directory,
    use javac's srcdir attribute probably srcdir="${PRJ_SRC}" -
    alternatively, you can use a nested <src> element, but as this is a
    path and not a fileset, you cannot nest the patternset into it
    (<javac> is somewhat like the union of filesets with directories taken
    from the <src> elements).

    BTW, you shouldn't need the classpath construct above as Ant adds your
    CLASSPATH to the javac command automatically.

    Stefan

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesant
postedJul 10, '01 at 11:46a
activeJul 10, '01 at 1:33p
posts2
users2
websiteant.apache.org

2 users in discussion

Stefan Bodewig: 1 post Steffen Euch: 1 post

People

Translate

site design / logo © 2018 Grokbase