Prelude: Ant-Contrib provides a very well explained wiki page for installation and launch ([http://ant-contrib.sourceforge.net/#install][1]).
Indeed, only two steps is necessary: - build ant-contrib-0.3.jar (by ant dist...), - move the built .jar into the lib directory of your Ant installation,
Use it by writing in your own project:
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
My problem: I succeeded to build the .jar (build successful is written). But I cannot find any "antcontrib.properties" in the jar built!
Request: What is the important thing I have forgotten? Is it better to search any ant-contrib-0.3.jar already built? Thanks
The Ant-Contrib project is a collection of user supplied task (like an <if> task) and a development playground for experimental tasks like a C/C++ compilation task for different compilers.
if you have teh later 1.0b3 version..
from http://sourceforge.net/projects/ant-contrib/
or http://ant-contrib.sourceforge.net
i beleive you have to use this one for ANT 1.6 and later :
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
instead of the antlib.properties file.
I made a simple installer called WinAnt that will install Ant and Ant-contrib for you.
If you download this file http://www.java2s.com/Code/JarDownload/ant-contrib-0.6.jar.zip, there's a antcontrib.properties contained. So maybe the installation instructions or the ant build file is out of date. Have you tried to use Maven for building the Ant-Contrib?
I use my custom in-build.xml installer. This bad boy detects if you have it in your ant lib dir, then downloads and inits it if it's not.
All you need to do is add a depends="init-ant-contrib" to your target, and bam. You have ant-contrib whenever/wherever you deploy -- As long as sourceforge doesn't take away the dl link.
<!-- ANT-CONTRIB autoinstaller -->
<available property="ant-contrib-exists"
file="${ant.library.dir}/ant-contrib-1.0b3.jar" />
<target name="download-ant-contrib" unless="ant-contrib-exists">
<mkdir dir="${ant.library.dir}" />
<get src="http://downloads.sourceforge.net/project/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fant-contrib%2Ffiles%2Fant-contrib%2F1.0b3%2F&use_mirror=cdnetworks-us-1"
dest="${ant.library.dir}/ant-contrib-1.0b3-bin.zip"
username="true" />
<unzip src="${ant.library.dir}/ant-contrib-1.0b3-bin.zip"
dest="${ant.library.dir}"
overwrite="no" />
<move todir="${ant.library.dir}">
<fileset file="${ant.library.dir}/ant-contrib/*.jar" />
<fileset file="${ant.library.dir}/ant-contrib/lib/*.jar" />
</move>
<delete file="${ant.library.dir}/ant-contrib-1.0b3-bin.zip" />
<delete dir="${ant.library.dir}/ant-contrib" />
</target>
<target name="init-ant-contrib" depends="download-ant-contrib">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${ant.library.dir}/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
</target>
You need to download ant-contrib-1.0b3 the latest version (1.0b5) does not contain ant-contrib-1.0b3.jar
Here's the place you can find binary ant-contrib distributions: http://sourceforge.net/project/showfiles.php?group_id=36177&package_id=28636
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With