We use both Tomcat 6 and 7 ant tasks in our build scripts. I don’t want to declare every single task by hand (I can’t just use taskdef with catalina.tasks, because Tomcat 6 and 7 tasks declare task names that conflict with each other), so I use namespaces:
<project name="teamcity" xmlns:tomcat6=" http://tomcat.apache.org/ant/tomcat/6" xmlns:tomcat7=" http://tomcat.apache.org/ant/tomcat/7"> … <path id="tomcat.6.ant.classpath"> <fileset dir="${my.path.library.build}/tomcat-6.0.35"><include name="*.jar" /></fileset> <path refid="my.path.compile.jsp" /> </path> <path id="tomcat.7.ant.classpath"> <fileset dir="${my.path.library.build}/tomcat-7.0.25"><include name="*.jar" /></fileset> <path refid="my.path.compile.jsp" /> </path> <typedef resource="org/apache/catalina/ant/antlib.xml" uri=" http://tomcat.apache.org/ant/tomcat/6" classpathref="tomcat.6.ant.classpath" /> <typedef resource="org/apache/catalina/ant/antlib.xml" uri=" http://tomcat.apache.org/ant/tomcat/7" classpathref="tomcat.7.ant.classpath" /> … <target> <tomcat6:list … /> <tomcat7:list …/> … </target> This works great for list, deploy, undeploy, stop, start, etc. All of those tasks work. But the jasper/jasper2 tasks are weird. They silently do nothing. <tomcat6:jasper … /> <tomcat7:jasper …/> Neither of these do anything. And by “nothing” I mean that I use `ant -verbose` when running Ant, verbose=”1” within the Jasper tasks, and there’s no output from the Jasper task, not a single line of output/logging, and the build completes in 0 seconds with no compiled JSPs output. However, if I define the Jasper task explicitly, using the exact same paths (as you can clearly see): <taskdef classname="org.apache.jasper.JspC" name="tomcat7-jsp-compile" > <classpath> <path refid="tomcat.7.ant.classpath" /> </classpath> </taskdef> And call the Jasper tasks using the exact same options: <tomcat7-jsp-compile …/> Everything works. It compiles 2,487 JSPs in 275s, and outputs exactly what I expect, including 2,487 compiled JSPs and two logging messages. From what I understand about Ant, there should be absolutely no difference, and yet there apparently is, because they behave differently. Any idea what gives? Then there’s the matter of the logging. The tomcat7-jsp-compile/tomcat6-jsp-compile tasks (the only ones that work) outputs two logging messages: Mar 29, 2012 8:50:35 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. However, they are output in such a way so as Ant sees them as warnings. So when the Ant build completes, it completes “with 2 warnings.” If I set verbose=”1” on the Jasper tasks, the Ant build completes “with 4976 warnings.” Obviously these aren’t warnings. Can something be done about the output to keep it from registering as a warning? Finally, there’s the matter of specifying a JVM. Other java/javac tasks allow you to specify an executable (javac)/jvm (java) to use when executing the task. I can’t find anything in the documentation that reveals a way to do this with the Jasper tasks. Can the Jasper tasks ONLY run in the same JVM as Ant? Thanks, Nick