diff --git a/docs/manual/Tasks/taskdef.html b/docs/manual/Tasks/taskdef.html index 22180c50c..4f6f5d2b9 100644 --- a/docs/manual/Tasks/taskdef.html +++ b/docs/manual/Tasks/taskdef.html @@ -31,7 +31,8 @@
This task is a form of Typedef with the attributes "adapter" and "adaptto" set to the values "org.apache.tools.ant.TaskAdapter" and "org.apache.tools.ant.Task" - respectively. + respectively. Anything said in the manual + page of typedef applies to taskdef as well.
<taskdef name="myjavadoc" classname="com.mydomain.JavadocTask"/>
makes a task called myjavadoc
available to Apache Ant. The class com.mydomain.JavadocTask
diff --git a/docs/manual/Tasks/typedef.html b/docs/manual/Tasks/typedef.html
index f9061b14a..7d0de52c3 100644
--- a/docs/manual/Tasks/typedef.html
+++ b/docs/manual/Tasks/typedef.html
@@ -62,6 +62,27 @@
Antlib section.
If you are defining tasks or types that share the same classpath + with multiple taskdef or typedef tasks, the corresponding classes + will be loaded by different + Java ClassLoaders. + Two classes with the same name loaded via different ClassLoaders + are not the same class from the point of view of the Java VM, they + don't share static variables and instances of these classes can't + access private methods or attributes of instances defined by "the + other class" of the same name. They don't even belong to the same + Java package and can't access package private code, either.
+ +The best way to load several tasks/types that are supposed to + cooperate with each other via shared Java code is to use the + resource attribute and an antlib descriptor. If this is not + possible, the second best option is to use the loaderref attribute + and specify the same name for each and every typedef/taskdef - + this way the classes will share the same ClassLoader. Note that + the typedef/taskdef tasks must use identical classpath defintions + (this includes the order of path components) for the loaderref + attribute to work.
+