Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-dev] get archetype catalog failed(can't load Ahcwagon)-m2e-0.12.1

hi, 
    I'm trying to use m2eclipse api to import projects by archetype.
my code is here:
RemoteCatalogFactory remoteCatalogFactory = new RemoteCatalogFactory("http:/server1/archetype-catalog.xml", null, true);
ArchetypeCatalog catalog = remoteCatalogFactory.getArchetypeCatalog();
List<Archetype> archetypes = catalog.getArchetypes();
for (Archetype archetype : archetypes){
System.out.println(archetype.getArtifactId());
}

m2eclipse version is:0.12.1.
Got below exception:
1) Error injecting: org.sonatype.maven.wagon.AhcWagon
  at ClassRealm[plexus.core, parent: null]
  while locating org.apache.maven.wagon.Wagon annotated with @com.google.inject.name.Named(value=http)

1 error
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:958)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:247)
... 38 more
Caused by: java.lang.TypeNotPresentException: Type org.sonatype.maven.wagon.AhcWagon not present
at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:94)
at org.sonatype.guice.bean.reflect.NamedClass.load(NamedClass.java:46)
at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
... 42 more
Caused by: java.lang.ClassNotFoundException: org.sonatype.maven.wagon.AhcWagon
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:90)

During debug, I found bundleloader is using org.maven.ide.eclipse's bundle classloader to load AhcWagon class.
because maven embedder bundle haven't export AhcWagon's package, so can't load it.

But my question is: caller(plexus-classworlds.jar) is in maven embedder bundle and AhcWagon(in wagon-ahc.jar) is in the same bundle. Why not use maven embedder's bundle loader to load AhcWagon?

Am I something wrong to use this API? 

That's great! If there is any sample code.

Regards
Simon

Back to the top