Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 387736

Summary: NPE thrown when no "action" supplied in lifecycle-mapping pluginExecution
Product: z_Archived Reporter: Mike Youngstrom <youngm>
Component: m2eAssignee: Till Brychcy <register.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fbricon, igor, register.eclipse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/123090
https://github.com/tesla/m2e-core-tests/pull/58
https://git.eclipse.org/c/m2e/m2e-core.git/commit/?id=a1e24f9f417719d3685824383291f05a111a409e
Whiteboard:
Attachments:
Description Flags
An example pom.xml that creates the NPE none

Description Mike Youngstrom CLA 2012-08-21 19:39:48 EDT
If I add a lifecycle-mapping plugin definition in my pom.xml that is invalid with no action or ignore element specified.  I get the following NPE.

java.lang.NullPointerException
	at org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionMetadata.getAction(PluginExecutionMetadata.java:81)
	at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.isPrimaryMapping(LifecycleMappingFactory.java:1113)
	at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:429)
	at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:219)
	at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateLifecycleMapping(LifecycleMappingFactory.java:170)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupLifecycleMapping(ProjectRegistryManager.java:526)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:445)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:327)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:278)
	at org.eclipse.m2e.core.internal.project.registry.MavenProjectManager.refresh(MavenProjectManager.java:58)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:87)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Mike Youngstrom CLA 2012-08-21 19:40:26 EDT
Created attachment 220121 [details]
An example pom.xml that creates the NPE
Comment 2 Igor Fedorenko CLA 2013-09-29 10:34:41 EDT
not exact duplication, but close enough to consolidate.

*** This bug has been marked as a duplicate of bug 371618 ***
Comment 3 Till Brychcy CLA 2018-05-22 11:00:47 EDT
The other bug is fixed, but this is still an issue, see e.g. https://stackoverflow.com/questions/50468068/org-eclipse-m2e-core-plugin-hitting-nullpointerexception-in-eclipse
Comment 4 Eclipse Genie CLA 2018-05-22 15:19:26 EDT
New Gerrit change created: https://git.eclipse.org/r/123090
Comment 5 Till Brychcy CLA 2018-05-22 15:43:34 EDT
Matching pull request with test: https://github.com/tesla/m2e-core-tests/pull/58
Comment 7 Fred Bricon CLA 2018-05-22 20:47:36 EDT
Thanks for the fix Till. Using a default configurator value seems a bit hackish but it does the job. No NPE and still produces the proper error message.
Comment 8 Denis Roy CLA 2021-04-19 13:23:20 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/