ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ant Wiki] Update of "AntNewbies" by mmr11408
Date Wed, 15 Feb 2006 18:13:29 GMT
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


Mime
View raw message