Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions in extensions.xml cause m2e not to update project in Eclipse #1310

Open
laurentgo opened this issue Mar 9, 2023 · 3 comments
Open

Comments

@laurentgo
Copy link

Observed on Eclipse 4.26/m2e 2.2.1 on MacOS (but this issue has been present for several Eclipse/M2E releases)

I work on a project which has a .mvn/extensions.xml configuration file and is causing Eclipse to fail importing and/or updating the project with the following error message:

Could not lookup required component
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting: public void org.apache.maven.eventspy.internal.EventSpyDispatcher.setEventSpies(java.util.List)
  at ClassRealm[maven.ext., parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.eventspy.internal.EventSpyDispatcher
    for field at org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory.eventSpyDispatcher(Unknown Source)
  while locating org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory
  while locating org.apache.maven.DefaultMaven
  at ClassRealm[maven.ext., parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.Maven

1 error
      role: org.apache.maven.Maven
  roleHint: 

If I comment the content of the file or remove it, Eclipse has no problem importing the project.

Attaching a small test project to reproduce the issue: m2e-lifecycle-issue.tar.gz

@HannesWell
Copy link
Contributor

HannesWell commented Feb 18, 2024

Can you please check if the problem still occurs with the latest snapshot:
https://download.eclipse.org/technology/m2e/snapshots/2.6.0/

@laurentgo
Copy link
Author

So far it seems to be working but I'm hitting a different issue (#1605)

@theit
Copy link

theit commented Dec 9, 2024

Hm, doesn't seem to be working correctly, at least on my machine:

I have a multi-module project which has a .mvn folder containing the following extensions:

<?xml version="1.0" encoding="UTF-8"?>
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.1.0 https://maven.apache.org/xsd/core-extensions-1.1.0.xsd">
    <extension>
        <groupId>me.qoomon</groupId>
        <artifactId>maven-git-versioning-extension</artifactId>
        <version>9.10.0</version>
    </extension>
    <extension>
        <groupId>org.apache.maven.extensions</groupId>
        <artifactId>maven-build-cache-extension</artifactId>
        <version>1.2.0</version>
    </extension>
</extensions>

I tried to update a module and the following error occurred (different than the one from the original post, but similar to the NPE in #1605):

!ENTRY org.eclipse.core.resources 4 75 2024-12-09 10:08:47.461
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.m2e.core 4 75 2024-12-09 10:08:47.461
!MESSAGE Errors running builder 'Maven Project Builder' on project '....'.
!STACK 0
java.lang.NullPointerException: Cannot invoke "org.apache.maven.model.InputLocation.getSource()" because the return value of "org.apache.maven.model.Model.getLocation(Object)" is null
        at org.eclipse.m2e.core.internal.lifecyclemapping.AnnotationMappingMetadataSource.parsePIs(AnnotationMappingMetadataSource.java:174)
        at org.eclipse.m2e.core.internal.lifecyclemapping.AnnotationMappingMetadataSource.get(AnnotationMappingMetadataSource.java:72)
        at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.getPomMappingMetadataSources(LifecycleMappingFactory.java:872)
        at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.getProjectMetadataSourcesMap(LifecycleMappingFactory.java:277)
        at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:249)
        at org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateLifecycleMapping(LifecycleMappingFactory.java:197)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupLifecycleMapping(ProjectRegistryManager.java:642)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refreshPhase2(ProjectRegistryManager.java:562)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$5(ProjectRegistryManager.java:487)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:485)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:370)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:322)
        at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:146)
        at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:84)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:278)
        at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:83)
        at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:192)
        at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
        at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
        at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
        at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
        at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
        at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
        at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Updating the submodule worked when I renamed the .mvn in the parent project...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants