You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Shaw, Kendall" <KS...@abtcorp.com> on 2000/07/20 22:08:37 UTC
Patterns
Hi,
I want to create a target that excludes a file, and another that compiles
only that one file, so I have tried this:
<target name="compile">
<javac srcdir="src" destdir="classes" excludes="**/asdf/User.java"
classpath="${classpath}" debug="off" optimize="on"
deprecation="on"/>
</target>
<target name="User.class">
<javac srcdir="src" destdir="classes"
excludes="**/*"
includes="**/asdf/User.java"
classpath="${classpath}" debug="off" optimize="on"
deprecation="on"/>
</target>
With the first target, ant reports that it's compiling 4 files (which would
be right) however it actually compiles all 5.
With the second target, it says:
Buildfile: build.xml
User.class:
BUILD SUCCESSFUL
Total time: 0 seconds
What am I doing wrong?
Kendall
Re: Patterns
Posted by Russell Gold <ru...@acm.org>.
At 01:08 PM 7/20/00 -0700, you wrote:
>Hi,
>
>I want to create a target that excludes a file, and another that compiles
>only that one file, so I have tried this:
>
> <target name="compile">
> <javac srcdir="src" destdir="classes" excludes="**/asdf/User.java"
> classpath="${classpath}" debug="off" optimize="on"
> deprecation="on"/>
> </target>
>
> <target name="User.class">
> <javac srcdir="src" destdir="classes"
> excludes="**/*"
> includes="**/asdf/User.java"
> classpath="${classpath}" debug="off" optimize="on"
> deprecation="on"/>
> </target>
>
>With the first target, ant reports that it's compiling 4 files (which would
>be right) however it actually compiles all 5.
The select decides which files are fed to the compiler. Javac will compile
any files you give it AND any files which those classes depend on. In the
first target, although you did not specify the User.java file, one of the
files you did specify must depend on it.
>With the second target, it says:
>
>Buildfile: build.xml
>
>User.class:
>
>BUILD SUCCESSFUL
>
>Total time: 0 seconds
>
>What am I doing wrong?
From the ant documentation:
"When both inclusion and exclusion are used, only files/directories that
match the include patterns, and don't match the exclude patterns are used."
You have excluded every file, so nothing gets compiled.