[ http://jira.codehaus.org/browse/MNG-1088?page=all ] Brett Porter closed MNG-1088: -----------------------------
Assign To: Brett Porter Resolution: Fixed > Plugins built and used within the same multiproject build fail unless > lifecycle phase is compile or later > --------------------------------------------------------------------------------------------------------- > > Key: MNG-1088 > URL: http://jira.codehaus.org/browse/MNG-1088 > Project: Maven 2 > Type: Bug > Components: maven-core > Environment: Win2000 Pro > Problem occurs on M2-2.0-BETA-2 as well as current SVN HEAD > (M2-2.0-beta-4-SNAPSHOT) > Reporter: Paul Russell > Assignee: Brett Porter > Fix For: 2.0-beta-4 > > > In my scenario, I have a plugin and the code that /uses/ this plugin within > the same multiproject build. Example layout: > <pre> > - root-project > +- plugins-root > |+- plugin-project (2) > +- application-root > +- application-module (1) > </pre> > In my situation, application-module (1) references plugin-project (2) as a > plugin. > If I do m2 eclipse:eclipse in on the root project, I get the following NPE: > <pre> > java.lang.NullPointerException > at > org.codehaus.plexus.DefaultPlexusContainer.addJarResource(DefaultPlexusContainer.java:1351) > at > org.codehaus.plexus.DefaultPlexusContainer.createChildContainer(DefaultPlexusContainer.java:244) > at > org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:286) > at > org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:186) > at > org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:161) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1057) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1022) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:854) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:737) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:721) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:517) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:498) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:307) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:217) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:247) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > at > org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) > at org.codehaus.classworlds.Launcher.main(Launcher.java:375) > </pre> > After a bit of digging around, I have tracked this down to the fact that the > plugin project's artifact is a ActiveProjectArtifact in this context, and > before a compile has been achieved, ActiveProjectArtifact.getFile() returns > null (because it returns the project artifact's file, which is null). > This same issue is triggered if any lifecycle phase prior to 'compile' is > requested on the root project. > There is a workaround, which is to execute the troublesome goal from within > the 'application-root' project, but I can't help but think this is something > that should just work. Unfortunately, I can't see a clean solution to this > right now. The only thing I can think is that having an intra-reactor plugin > dependency should force the compile lifecycle to execute on that plugin prior > to the plugin being added to the plugin manager. Unfortunately I'm struggling > to understand how to achieve that at the moment. > If a solution to this can't be found, it is probably worth adding an error > trap within the plugin manager to catch errant ActiveProjectArtifacts before > they are added to plexus and display a more helpful error message. > I'll have a think and see if I can find an elegant solution. -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]