I'm trying to use m2eclipse api to import projects by archetype.
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.
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)
That's great! If there is any sample code.