Maven Ant Tasks are switching the Classloader of the Main Ant Thread --------------------------------------------------------------------
Key: MANTTASKS-108 URL: http://jira.codehaus.org/browse/MANTTASKS-108 Project: Maven 2.x Ant Tasks Issue Type: Bug Components: deploy task Affects Versions: 2.0.8 Environment: I have testet it on windows as well as linux. Reporter: Thomas Tardy Priority: Critical There is a thread on the user mailing list which describes the problem. http://www.nabble.com/Using-Maven-Ant-Tasks-in-a-CI-Environment-with-IBM-Jazz-tt16556859s177.html#a16574083 The problem can be reproduced with the following script. The ant build script: <?xml version="1.0" encoding="UTF-8"?> <project name="MavenTest" default="default" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> <description> description </description> <taskdef name="mavenTestTask" classname="maven.test.task.MavenTestTask" /> <target name="default"> <echo message="Invoking test class that does nothing but echo the classloader"/> <mavenTestTask/> <echo message="Invoking maven artifact:pom task"/> <artifact:pom id="pom" file="C:/maven-sample/my-app/pom.xml" /> <echo message="Invoking test class again that does nothing but echo the classloader"/> <mavenTestTask/> </target> </project> The simple Ant Task: package maven.test.task; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; /** * Test task demonstrating Maven switching the class loader. */ public class MavenTestTask extends Task { /* (non-Javadoc) * Intentionally not documented. See parent. */ @Override public void execute() throws BuildException { log("Current Class Loader: " + Thread.currentThread().getContextClassLoader()); } The output when run in Ant: Buildfile: C:\Maven\Test\build.xml default: [echo] Invoking test class that does nothing but echo the classloader [mavenTestTask] Current Class Loader: [EMAIL PROTECTED] [echo] Invoking maven artifact:pom task [echo] Invoking test class again that does nothing but echo the classloader [mavenTestTask] Current Class Loader: [EMAIL PROTECTED] BUILD SUCCESSFUL Total time: 871 milliseconds Thanks for your support! -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira