You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Herve Boutemy (JIRA)" <ji...@codehaus.org> on 2008/04/10 23:00:58 UTC
[jira] Closed: (MANTTASKS-108) Maven Ant Tasks are switching the
Classloader of the Main Ant Thread
[ http://jira.codehaus.org/browse/MANTTASKS-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Herve Boutemy closed MANTTASKS-108.
-----------------------------------
Assignee: Herve Boutemy
Resolution: Fixed
Fix Version/s: 2.0.9
fixed in r646946
> 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
> Assignee: Herve Boutemy
> Priority: Critical
> Fix For: 2.0.9
>
>
> 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: sun.misc.Launcher$AppClassLoader@e39a3e
> [echo] Invoking maven artifact:pom task
> [echo] Invoking test class again that does nothing but echo the classloader
> [mavenTestTask] Current Class Loader: org.codehaus.classworlds.RealmClassLoader@c79809
> 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