You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Apache Wiki <wi...@apache.org> on 2006/02/15 19:13:29 UTC
[Ant Wiki] Update of "AntNewbies" by mmr11408
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Ant Wiki" for change notification.
The following page has been changed by mmr11408:
http://wiki.apache.org/ant/AntNewbies
------------------------------------------------------------------------------
----
+ ```Question#15```
+ How do I perform a task only if Ant is going to perform a task?
+
+ I want to create a file only if and only if at least one of my java source files needs to be compiled. I do not want the file created otherwise. Here is what I have:
+ <macrodef name="compile.macro" >
+ <attribute name="destination" />
+ <element name="inputfiles" optional="false" />
+ <sequential>
+ <echo file="${basedir}/src/ServiceVersion.java">
+ package mypackage;
+ public final class ServiceVersion
+ {
+ public static String getVersion()
+ { return "${release.number} ${DSTAMP}"; }
+ }
+ </echo>
+ <javac destdir="@{destination}" deprecation="true" >
+ <inputfiles />
+ <classpath refid="compile.classpath" />
+ </javac>
+ </sequential>
+ </macrodef>
+
+ This will create the file every time which is not desirable.
+
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org