tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Williams, Nick" <>
Subject RE: antlib.xml vs catalina.tasks (was: Re: r1346638)
Date Sun, 24 Jun 2012 20:00:22 GMT
-----Original Message-----
From: Konstantin Kolinko []
Sent: Sunday, June 24, 2012 11:15 AM
To: Tomcat Developers List
Subject: antlib.xml vs catalina.tasks (was: Re: r1346638)

2012/6/6 Mark Thomas <>:
> On 06/06/2012 00:22, Konstantin Kolinko wrote:
>> 2012/6/6 Mark Thomas <>:
>>> On 05/06/2012 23:42, Konstantin Kolinko wrote:
>>>> 2012/6/6  <>:
>>>>> Author: markt
>>>>> Date: Tue Jun  5 22:38:53 2012
>>>>> New Revision: 1346638
>>>>> URL:
>>>>> Log:
>>>>> Remove unused file
>>>>> Removed:
>>>>>    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ant/antlib.xml
>>>>> Modified:
>>>>>    tomcat/tc7.0.x/trunk/   (props changed)
>>>>> Propchange: tomcat/tc7.0.x/trunk/
>>>>> ------------------------------------------------------------------
>>>>> ------------
>>>>>  Merged /tomcat/trunk:r1346635
>>>> Please explain, why do you think that this file is unused?
>>> Because:
>>> - it is not referenced anywhere in the code base
>> It should not be referenced. We do not bundle Ant with Tomcat.
>>> - it does not include JspC
>> Those tasks are related to server management. You do not need to
>> precompile JSPs for that.
>> It can be solved by adding the two missing tasks.
>>> - all our code examples (including the docs) use catalina.tasks to
>>> do the same thing
>> Though we do not directly use
>>   org/apache/catalina/ant/antlib.xml
>> we certainly do use the one here:
>>   org/apache/catalina/ant/jmx/antlib.xml
>> The latter one is mentioned in the docs:
>> I would also say that antlib sounds like a more modern approach.
>> Anyway I am -1 on removing this file from stable versions. It may
>> break systems and I do not see what problem this removal solves.
> The problem it solves is unnecessary duplication leading to additional
> maintenance effort and bugs when they get out of sync. I don't see the
> point of having two files that do the same thing. I don't particularly
> care whether we keep catalina.tasks or antlib.xml. I just deleted the
> one we weren't using anywhere and hadn't documented anywhere.
> I can restore the file in 7.0.x easily enough.
> If you prefer antlib.xml to catalina.tasks then I have no objection to
> you making antlib.xml the standard in 8.0.x onwards as long as the
> documentation is updated to that effect as well.

Current status:
1) Mark restored antlib.xml in Tomcat 7 and I restored it in trunk.
2) I aligned  antlib.xml with *.tasks files in trunk and TC7 (proposed for 6.0 as well)

We have two pairs of antlib.xml vs *.tasks files, in o.a.c.ant and in o.a.c.ant.jmx.

Several notes in comparison of antlib.xml vs *.tasks files:
1. Documentation
* The *.tasks files are not explicitly mentioned in documentation, but are used
- by bin/catalina-tasks.xml
- by sample application in appdev documentation (appdev/build.xml.txt,  also copied to appdev/sample/build.xml
at build time)
- by Deployer (res/deployer/build.xml)

* Jasper documentation (jasper-howto.html)  recommends bin/catalina-tasks.xml

* Deployer documentation (deployer-howto.html) does not mention anything explicitly, but references
the build.xml file included with deployer package.

* Monitoring and Management documentation (monitoring.html) documents two ways to configure
jmx tasks
  a) using antlib, b) using import + catalina-tasks.xml

2. Using antlib is easier when you can put your jars into Ant classpath (as recommended for
jmx tasks). It is not easy for jasper, as many jars are involved there.

In Ant documentation there is example how to use "typedef" + namespaces [1].


3. JMX tasks in jmx/antlib.xml file and in jmxaccessor.tasks have different names.

The latter ones are suitable to use without namespaces, as they are named as "jmxSomething".

To get rid of *.tasks files a plan can be the following:
(in Tomcat 8 only)
I have not yet tested whether <import> in Ant correctly operates with namespaces.

I have not yet tested whether namespace uris in Ant need to start with "antlib:" prefix.
I suspect that there is no need for "antlib" prefix in URIs when explicit typedef is used.

If the above works, then plan is the following.

1. Update bin/catalina-tasks.xml to define Tomcat and JMX tasks like the following:
<project name="catalina-tasks">
  <description>Catalina Ant Manager, JMX and JSPC Tasks</description>
  <!-- set catalina.home if it's not already set -->
  <dirname property="catalina.home.bin.dir" file="${ant.file.catalina-tasks}"/>
  <property name="catalina.home" value="${catalina.home.bin.dir}/.."/>
  <typedef resource="org/apache/catalina/ant/antlib.xml"
      <fileset file="${catalina.home}/bin/tomcat-juli.jar"/>
      <fileset file="${catalina.home}/lib/jasper.jar"/>
      <fileset file="${catalina.home}/lib/jasper-el.jar"/>
      <fileset file="${catalina.home}/lib/el-api.jar"/>
      <fileset file="${catalina.home}/lib/jsp-api.jar"/>
      <fileset file="${catalina.home}/lib/servlet-api.jar"/>
      <fileset file="${catalina.home}/lib/catalina-ant.jar"/>
  <typedef resource="org/apache/catalina/ant/jmx/antlib.xml"
      <fileset file="${catalina.home}/lib/catalina-ant.jar"/>

2. Using catalina-tasks.xml will look like the following, with namespaces:
- in jasper-howto.html

<project name="Webapp Precompilation" default="all" basedir="."

   <import file="${tomcat.home}/bin/catalina-tasks.xml"/>

   <target name="jspc">
      <tomcat:jasper ... />

3. Remove catalina.tasks, jmxaccessor.tasks files.

4. res/deployer/build.xml will use explicit <typedef>, like it does now, but it will
use namespaces and prefixes for all Tomcat tasks.

5. I think that maybe webapps/docs/appdev/build.xml.txt will be changed to use catalina-tasks.xml
instead of typedef.

6. Update monitoring.html  to use jmx: prefix for JMX tasks everywhere.
The jmxSomething tasks have to be removed.

The two ways to define tasks as documented there are still possible (antlib vs catalina-tasks.xml),
the only difference are namespace URIs. I plan to use "antlib:" URI with antlib, and "urn:"
URI with catalina-tasks.xml.

Best regards,
Konstantin Kolinko


Sorry for the late comment. I strongly disagree with the removal of this file AND with the
synchronization of the two files. The use of the management-related tasks (deploy, undeploy,
etc.) only requires the presence of one file on the classpath (catalina-ant.jar). As soon
as you add the Jspc task to the file, you must have nearly every single Tomcat JAR file on
the classpath. There should be a file for defining only the management-related tasks without
having to put nearly every JAR file on the classpath. There may not be any references to this
file in code or documentation, but it is the only file we use when we aren't compiling JSPs,
so that we don't have to include every Tomcat JAR file on the classpath.

This e-mail may contain privileged or confidential information. If you are not the intended
recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s);
and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s).
Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions,
corruption or virus in this message or any attachments.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message