0

Imported a maven project in Eclipse Oxygen and am hitting this issue with org.eclipse.m2e.core plugin when building the project. m2e version is 1.8.3, anybody know why this happens? I have seen similiar issues in bug reports from way back but they were marked as fixed from version 1.1 onwards.

java.lang.NullPointerException
at org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionMetadata.getAction(PluginExecutionMetadata.java:144)
at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.isConfigurator(LifecycleMappingFactory.java:718)
at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata0(LifecycleMappingFactory.java:602)
at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:535)
at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:249)
at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateLifecycleMapping(LifecycleMappingFactory.java:181)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupLifecycleMapping(ProjectRegistryManager.java:594)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refreshPhase2(ProjectRegistryManager.java:513)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$3.call(ProjectRegistryManager.java:492)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$3.call(ProjectRegistryManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:496)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:351)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:298)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:154)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:89)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)

Furthermore if you actually go and try to check out the code here:

https://github.com/eclipse/m2e-core/tree/m2e-1.8.x/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping

this package doesn't even seem to exist? WTH is going on here? Has this project been forked to hell and I'm looking in the wrong place? Should I just pack up and start using IntelliJ, seems like m2e has become unmanageable in Eclipse. The lifecyclemapping is defined as such in a parent

  <pluginManagement>
    <plugin>
      <groupId>org.eclipse.m2e</groupId>
      <artifactId>lifecycle-mapping</artifactId>
      <version>1.0.0</version>
      <configuration>
        <lifecycleMappingMetadata>
          <pluginExecutions>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <versionRange>[2.10,)</versionRange>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
              </pluginExecutionFilter>
            </pluginExecution>
          </pluginExecutions>
        </lifecycleMappingMetadata>
      </configuration>
    </plugin>
  </pluginManagement>

1 Answer 1

1

PluginExecutionMetadata is generated from lifecycle-mapping-metadata-model.xml using modello

The line in the generated code where the NPE happens is

org.codehaus.plexus.util.xml.Xpp3Dom actionDom = ((org.codehaus.plexus.util.xml.Xpp3Dom) getActionDom()).getChild(0);

This points to the answer: In your xml snippet, the required <action> tag is missing, e.g. like:

             </pluginExecutionFilter>
             <action>
               <ignore/>
             </action>
           </pluginExecution>
8
  • I've already added <execute/> or <ignore/> here and am still seeing the same issue during the build. I'm suspecting that maybe Eclipse is caching the pom, but clearing out .metadata or the project files doesn't seem to fix it.
    – user898465
    May 22, 2018 at 14:21
  • Have you increased the version of the parent pom? May 22, 2018 at 14:41
  • I haven't actually changed the parent pom at all, I added this config in the child pom to overwrite the behaviour in the parent pom (where action was not specified). I'm looking at the effective pom and it seems to show the action present, but am still getting null pointer.
    – user898465
    May 22, 2018 at 14:45
  • 1
    While you were writing this, I've reopened bugs.eclipse.org/bugs/show_bug.cgi?id=387736 May 22, 2018 at 15:01
  • 1
    The NPE will be fixed in m2e 1.9 (for Eclipse Photon) May 23, 2018 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.