Includes acts as a filter, not as a list of files.
It is more often uses as "mypackage/*.java" or "mypackage/**/*.java" - i.e. a filter.


To do what you want, you would need to use the <fail> task with a <condition> with the <available> condition.

Something like
<fail message="missing a source file">
<condition>
<not>
<and>
<available file="${source}/mypackage/ExportService.java"/>
<available file="${source}/mypackage/RetrieveService.java"/>
<available file="${source}/separate/package/UpdateProperty.java"/>
</and>
</not>
</condition>
</fail>


Peter

Jan Almås wrote:

Hi all Ant users,

we have been using Ant in our projects for 2+ years now. We have recently discovered a potential dangerous error (or we believe it's an error at least).

When using Ant to compile our package with an explicit includes statement, Ant ignores the fact that the file can't be found. Since we are using some reflection to minimize coupling, we need this feature but this can be dangerous since parts of the package might be omitted from the distribution jar.

<target name="compile_server" depends="init">
<javac
includes="mypackage/ExportService.java,
mypackage/RetrieveService.java,
separate/package/UpdateProperty.java" <-- MISSING FROM ${source}, build successful
srcdir="${source}"
destdir="${classes}"
debug="on">
<classpath>
<pathelement location="${3plib}/servlet/servlet2.3/servlet.jar"/>
<path refid="cb.depend.class.path"/>
<path refid="crewlist.depend.class.path"/>
</classpath>
</javac>
</target>




Does anyone have any experience with this?


Rgds,

Jan Almaas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to