Description
When using Maven Resolver 1.4.1 in combination with Maven 3.6.2 (also 3.6.3) we face the following errors when we bootstrap our application:
Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:1) No implementation for org.apache.maven.model.composition.DependencyManagementImporter was bound. while locating org.apache.maven.model.composition.DependencyManagementImporter for field at org.apache.maven.model.building.DefaultModelBuilder.dependencyManagementImporter(DefaultModelBuilder.java:207) at org.apache.maven.repository.internal.MavenResolverModule.configure(MavenResolverModule.java:58) (via modules: build.development.boot.Bootstrap$ResolverModule -> org.apache.maven.repository.internal.MavenResolverModule)2) No implementation for org.apache.maven.model.management.DependencyManagementInjector was bound. while locating org.apache.maven.model.management.DependencyManagementInjector for field at org.apache.maven.model.building.DefaultModelBuilder.dependencyManagementInjector(DefaultModelBuilder.java:213) at org.apache.maven.repository.internal.MavenResolverModule.configure(MavenResolverModule.java:58) (via modules: build.development.boot.Bootstrap$ResolverModule -> org.apache.maven.repository.internal.MavenResolverModule) ... 17 errors at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107) at com.google.inject.Guice.createInjector(Guice.java:99) at com.google.inject.Guice.createInjector(Guice.java:73) at com.google.inject.Guice.createInjector(Guice.java:62)
The relevant code part is:
Guice.createInjector(new ResolverModule()).getInstance(RepositorySystem.class); static class ResolverModule extends AbstractModule { @Override protected void configure() { install(new MavenResolverModule()); bind(RepositoryConnectorFactory.class).annotatedWith(Names.named("basic")).to(BasicRepositoryConnectorFactory.class); bind(TransporterFactory.class).annotatedWith(Names.named("file")).to(FileTransporterFactory.class); bind(TransporterFactory.class).annotatedWith(Names.named("http")).to(HttpTransporterFactory.class); } @Provides @Singleton Set<RepositoryConnectorFactory> provideRepositoryConnectorFactories(@Named("basic") RepositoryConnectorFactory basic) { Set<RepositoryConnectorFactory> factories = new HashSet<>(); factories.add(basic); return Collections.unmodifiableSet(factories); } @Provides @Singleton Set<TransporterFactory> provideTransporterFactories(@Named("file") TransporterFactory file, @Named("http") TransporterFactory http) { Set<TransporterFactory> factories = new HashSet<>(); factories.add(file); factories.add(http); return Collections.unmodifiableSet(factories); } }
This works with either maven-resolver-provider 3.6.0 or downgrading allĀ org.apache.maven.resolver artifacts to 1.3.1.
It seems as if a similar problem occurred in Idea when setting used Maven version to 3.6.2:
https://youtrack.jetbrains.com/issue/IDEA-221882
Is this a regression introduced in one of the recent maven-resolver versions?
Attachments
Issue Links
- is fixed by
-
MRESOLVER-186 Update Maven version in Resolver Demo Snippets
- Closed