[ https://jira.codehaus.org/browse/MRRESOURCES-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=292804#comment-292804 ]
Sergei Ivanov commented on MRRESOURCES-58: ------------------------------------------ Quick overview of the problem and the applied patch. When the goal runs at execution root only, it merges direct dependencies for all chilren projects in order to create a filter for transitive dependencies. When a dependency is declared with version ranges, its 'version' property is undefined until the resolution time. This is fine for the plugin's current use case, where it feeds the combined set of unresolved artifacts into Transitive filter (which only compares groupId and artifactId and does not care about versions). However, when the combined artifact set is itself being built, artifacts are compared using equals(), and in equals() version is not expected to be null. The fix is to set missing version to some arbitrary value (e.g. "LATEST") before adding to the set. > 'process' goal fails with NPE at the root of a reactor if child modules use > version ranges for dependencies > ----------------------------------------------------------------------------------------------------------- > > Key: MRRESOURCES-58 > URL: https://jira.codehaus.org/browse/MRRESOURCES-58 > Project: Maven 2.x Remote Resources Plugin > Issue Type: Bug > Affects Versions: 1.2.1, 1.3 > Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 17:31:09+0000) > Java version: 1.6.0_25, vendor: Sun Microsystems Inc. > Default locale: en_GB, platform encoding: UTF-8 > OS name: "windows xp", version: "5.1", arch: "x86", family: "windows" > Reporter: Sergei Ivanov > Attachments: test-reactor-version-ranges.zip, > version-ranges-bugfix.patch > > > When the maven-remote-resources-plugin:process goal is integrated into the > lifecycle of a parent project in a multi-module reactor build, the goal fails > with an NPE if dependency version ranges are used in the child modules. > Additionally, "runOnlyAtExecutionRoot" option needs to be set to true in > order to recreate the problem. Please see the attached test project that > demonstrates the problem. > Full exception trace is as follows: > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-remote-resources-plugin:1.2.1:process > (process-remote-resources) on project test-parent: Execution > process-remote-resources of goal > org.apache.maven.plugins:maven-remote-resources-plugin:1.2.1:process failed. > NullPointerException -> [Help 1] > org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute > goal org.apache.maven.plugins:maven-remote-resources-plugin:1.2.1:process > (process-remote-resources) on project test-parent: Execution > process-remote-resources of goal > org.apache.maven.plugins:maven-remote-resources-plugin:1.2.1:process failed. > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) > at > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) > at > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) > at > org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) > at > org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) > 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:597) > at > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) > at > org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) > at > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) > at > org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) > at org.codehaus.classworlds.Launcher.main(Launcher.java:47) > 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:597) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) > Caused by: org.apache.maven.plugin.PluginExecutionException: Execution > process-remote-resources of goal > org.apache.maven.plugins:maven-remote-resources-plugin:1.2.1:process failed. > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) > ... 25 more > Caused by: java.lang.NullPointerException > at > org.apache.maven.artifact.DefaultArtifact.equals(DefaultArtifact.java:344) > at java.util.HashMap.put(HashMap.java:376) > at java.util.HashSet.add(HashSet.java:200) > at java.util.AbstractCollection.addAll(AbstractCollection.java:305) > at > org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.aggregateProjectDependencyArtifacts(ProcessRemoteResourcesMojo.java:749) > at > org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.getProjects(ProcessRemoteResourcesMojo.java:624) > at > org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.configureVelocityContext(ProcessRemoteResourcesMojo.java:988) > at > org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.execute(ProcessRemoteResourcesMojo.java:511) > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) > ... 26 more -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira