Off the record

Aller au contenu | Aller au menu | Aller à la recherche

mercredi 17 octobre 2007

Another ant trick

need to print the ant version at build, just because?

<echo message="******************** " />
<echo message="${ant.version}" />
<echo message="******************** " />

Done !
Java version?

<echo message="******************** " />
<echo message="${ant.java.version}" />
<echo message="******************** " />

Secure copy over the network with ant :

<scp todir="${username}:${password}@${host}:${destination_dir}" trust="true">
<fileset dir="${src_dir}"/>
</scp>

This ant task, however, needs additional libs : check for the keyword scp here... Afterwards, if you use Eclipse to run ant, you need to do the following :

Go into Eclipse then click on Window->Preferences->ant->Runtime, then select 'Ant Home Entries (Default). Click on the button 'Add External JARs'. Locate the jar file you copied, select it and hit 'OK'.

Need to tell Ant about the proxy?
set ANT_OPTS=-Dhttp.proxyHost=myproxy -Dhttp.proxyPort=3128

vendredi 11 mai 2007

Use dates with ant

Need to generate a jar file including the current date in your ant script?
Here :

<tstamp/> <!-- extract the system date to the ant environment -->
<jar destfile="${build}/${DSTAMP}-${TSTAMP}-myfile.zip" etc.


Hope that helps someone somewhere !