From 82f9f6a1779c25e52234766ef5033c3c87be05fe Mon Sep 17 00:00:00 2001
From: Jan Materne com.mydomain.URLSet
implements this type.
Assuming a class org.acme.ant.RunnableAdapter that extends Task and implements org.apache.tools.ant.TypeAdapter, @@ -181,6 +183,8 @@ classname="com.acme.ant.RunClock" adapter="org.acme.ant.RunnableAdapter"/> + +
The following fragment shows the use of the classpathref and loaderref to load up two definitions. @@ -200,8 +204,22 @@ loaderref="lib.path.loader" /> + + +
+ If you want to load an antlib into a special xml-namespace, the uri attribute + is important: +
++ <project xmlns:antcontrib="antlib:net.sf.antcontrib"> + <taskdef uri="antlib:net.sf.antcontrib" + resource="net/sf/antcontrib/antlib.xml" + classpath="path/to/ant-contrib.jar"/> ++ +
Copyright © 2001-2005 Apache Software +
Copyright © 2001-2006 Apache Software Foundation. All rights Reserved.
An antlib file is an xml file with a root element of "antlib". @@ -44,6 +46,14 @@ <typedef name="scriptpathmapper" classname="org.acme.ant.ScriptPathMapper" onerror="ignore"/> + <macrodef name="print"> + <attribute name="file"/> + <sequential> + <concat taskname="print"> + <fileset dir="." includes="@{file}"/> + </concat> + </sequential> + </macrodef> </antlib> @@ -81,6 +91,8 @@ </sample:if> + +
The name space URIs with the pattern antlib:java package @@ -127,6 +139,36 @@ The requirement that the resource is in the default classpath may be removed in future versions of Ant.
+ + ++ If you want to seperate the antlib from your local Ant installation, e.g. because you + want to hold that jar in your projects SCM system, you have to specify a classpath, so + that Ant could find that jar. The best solution is loading the antlib with <taskdef>. +
+++ + + ++<project xmlns:antcontrib="antlib:net.sf.antcontrib"> + <taskdef uri="antlib:net.sf.antcontrib" + resource="net/sf/antcontrib/antlib.xml" + classpath="path/to/ant-contrib.jar"/> + + <target name="iterate"> + <antcontrib:for param="file"> + <fileset dir="."/> + <sequential> + <echo message="- @{file}"/> + </sequential> + </antcontrib:for> + </target> +</project> ++
Definitions defined in antlibs may be used in antlibs. However @@ -158,6 +200,8 @@ </antlib> + +
Antlibs may make use of other antlibs. @@ -201,7 +245,7 @@
Copyright © 2003-2005 Apache Software +
Copyright © 2003-2006 Apache Software Foundation. All rights Reserved.