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.
