Martin Böhm created MECLIPSE-738: ------------------------------------ Summary: NullPointerException in LinkedResource if <locationURI> is present in .project Key: MECLIPSE-738 URL: https://jira.codehaus.org/browse/MECLIPSE-738 Project: Maven 2.x Eclipse Plugin Issue Type: Bug Affects Versions: 2.9 Reporter: Martin Böhm Priority: Trivial Attachments: linkedResourceProblem.zip
I get a reproducable NullPointerException if I call eclipse:eclipse on a project that always has a .project-file that contains links with <locationURI>-Tags. {code} [ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse (default-cli) on project linkedResourceProblem: Execution def ault-cli of goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse failed. NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse (default-cli) on project linkedResourceProblem: Execution default-cli of goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse 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:320) 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:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse f ailed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.lang.NullPointerException at org.apache.maven.plugin.eclipse.LinkedResource.<init>(LinkedResource.java:131) at org.apache.maven.plugin.eclipse.writers.EclipseProjectWriter.write(EclipseProjectWriter.java:154) at org.apache.maven.plugin.eclipse.EclipsePlugin.writeConfiguration(EclipsePlugin.java:1232) at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSupportMojo.java:511) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) ... 20 more {code} If I change the present <locationURI> to <location> in .project and call eclipse:eclipse I won't get the error. Also if I call eclipse:clean before calling eclipse:eclipse the .project file of course gets cleaned and will be created new, so temporary links get lost unfortunately. I suppose it has to do with the following lines in org.apache.maven.plugin.eclipse.LinkedResource and how the locationNode is retrieved. {code} 119 Xpp3Dom locationNode = node.getChild( "location" ); 120 Xpp3Dom locationURINode = node.getChild( "locationURI" ); {code} Possible workarounds: - Call eclipse:clean before and recreate temporary links again. - Replace all <locationURI> with <location> before calling eclipse:eclipse to preserve temporary links. -- 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