Maven Antrun Plugin
  1. Maven Antrun Plugin
  2. MANTRUN-123

Plugin class path pollutes class path of custom tasks

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Maven 3.0-alpha-3
    • Number of attachments :
      1

      Description

      Steps to reproduce:

      svn co https://appfuse.dev.java.net/svn/appfuse/trunk/archetypes (user: guest, pass: <blank>)

      mvn install

      Here's the build.xml file:

      http://source.appfuse.org/browse/appfuse/trunk/archetypes/build.xml?r=HEAD

      [ERROR] An Ant BuildException has occured: The following error occurred while executing this line:
      /Users/mraible/Work/appfuse/archetypes/build.xml:14: java.lang.NoSuchMethodError: org.codehaus.plexus.DefaultPlexusContainer.setClassWorld(Lorg/codehaus/classworlds/ClassWorld;)V
      -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      1. err.log
        5 kB
        Benjamin Bentmann

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          The problem here is that the Ant Tasks see the wrong classes. The Ant Tasks are fully self-contained but when run by the AntRun Plugin, many classes get erroneously loaded from the Maven core realm instead of the maven-ant-tasks.jar, giving rise to linkage errors like the one reported here.

          A temporary workaround seems to be the reverseLoader="true" attribute for the <typedef>:

          <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" reverseLoader="true">
          

          Not sure how this can be fixed ultimately, i.e. whether the AntRun Plugin can be enhanced to provide better class loader isolation or whether we need to workaround this in the Ant Tasks by shading each and every class.

          Show
          Benjamin Bentmann added a comment - The problem here is that the Ant Tasks see the wrong classes. The Ant Tasks are fully self-contained but when run by the AntRun Plugin, many classes get erroneously loaded from the Maven core realm instead of the maven-ant-tasks.jar , giving rise to linkage errors like the one reported here. A temporary workaround seems to be the reverseLoader="true" attribute for the <typedef> : <typedef resource= "org/apache/maven/artifact/ant/antlib.xml" uri= "urn:maven-artifact-ant" reverseLoader= "true" > Not sure how this can be fixed ultimately, i.e. whether the AntRun Plugin can be enhanced to provide better class loader isolation or whether we need to workaround this in the Ant Tasks by shading each and every class.
          Hide
          Jason van Zyl added a comment -

          Maybe we can find a better way to do this? The Ant Tasks inside the Ant Run plugin in a Maven build? Seriously?

          Show
          Jason van Zyl added a comment - Maybe we can find a better way to do this? The Ant Tasks inside the Ant Run plugin in a Maven build? Seriously?
          Hide
          Benjamin Bentmann added a comment -

          I haven't groked the build.xml in detail, but I would expect the Maven Invoker Plugin to serve as a replacement for many of the Maven invocations from the script.

          Show
          Benjamin Bentmann added a comment - I haven't groked the build.xml in detail, but I would expect the Maven Invoker Plugin to serve as a replacement for many of the Maven invocations from the script.
          Hide
          Matt Raible added a comment -

          The reason for the complicated build script is to workaround the bugs I found in the archetype plugin.

          http://old.nabble.com/Issues-with-archetype%3Acreate-from-project-to23286970.html

          Thanks for the info on the Invoker Plugin. Could be useful for installing, testing and deploying the generated archetype.

          Show
          Matt Raible added a comment - The reason for the complicated build script is to workaround the bugs I found in the archetype plugin. http://old.nabble.com/Issues-with-archetype%3Acreate-from-project-to23286970.html Thanks for the info on the Invoker Plugin. Could be useful for installing, testing and deploying the generated archetype.
          Hide
          Matt Raible added a comment - - edited

          FWIW, using reverseLoader="true" does solve the problem and allows this setup to work with Maven 3 alpha 3.

          Unfortunately, it breaks Maven 2.2.1 if I add it.

          16-Nov-2009 19:55:13 [INFO] Executing tasks
          16-Nov-2009 19:55:13 [typedef] The reverseloader attribute is DEPRECATED. It will be removed
          16-Nov-2009 19:55:13 [INFO] ------------------------------------------------------------------------
          16-Nov-2009 19:55:13 [ERROR] BUILD ERROR
          16-Nov-2009 19:55:13 [INFO] ------------------------------------------------------------------------
          16-Nov-2009 19:55:13 [INFO] An Ant BuildException has occured: The following error occurred while executing this line:
          16-Nov-2009 19:55:13 /opt/j2ee/domains/appfuse.org/builds/webapps/atlassian-bamboo/data/atlassian-bamboo-2.2.1/xml-data/build-dir/APF-DEPLOY/archetypes/build.xml:14: java.lang.ClassCastException: org.apache.maven.plugin.MavenPluginDiscoverer

          Show
          Matt Raible added a comment - - edited FWIW, using reverseLoader="true" does solve the problem and allows this setup to work with Maven 3 alpha 3. Unfortunately, it breaks Maven 2.2.1 if I add it. 16-Nov-2009 19:55:13 [INFO] Executing tasks 16-Nov-2009 19:55:13 [typedef] The reverseloader attribute is DEPRECATED. It will be removed 16-Nov-2009 19:55:13 [INFO] ------------------------------------------------------------------------ 16-Nov-2009 19:55:13 [ERROR] BUILD ERROR 16-Nov-2009 19:55:13 [INFO] ------------------------------------------------------------------------ 16-Nov-2009 19:55:13 [INFO] An Ant BuildException has occured: The following error occurred while executing this line: 16-Nov-2009 19:55:13 /opt/j2ee/domains/appfuse.org/builds/webapps/atlassian-bamboo/data/atlassian-bamboo-2.2.1/xml-data/build-dir/APF-DEPLOY/archetypes/build.xml:14: java.lang.ClassCastException: org.apache.maven.plugin.MavenPluginDiscoverer

            People

            • Assignee:
              Unassigned
              Reporter:
              Matt Raible
            • Votes:
              15 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated: