You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Dan Rollo <da...@gmail.com> on 2011/03/11 06:57:42 UTC

Re: Maven Embedder 2.0.4 replacement; Where to start?

Thanks for these links Benjamin. I'm working on converting the old 2.0.4 
embedder code, and I managed to get things to compile by reading the 
imports/code in the m2eclipse link you sent, adding jars to my classpath 
and tweaking calls, wash, rinse, repeat. So far I have the following 
jars on the classpath:

maven-artifact-3.0.3.jar
maven-compat-3.0.3.jar
maven-core-3.0.3.jar
maven-embedder-3.0.3.jar
maven-model-3.0.3.jar
maven-model-builder-3.0.3.jar

Please holler if you see any I should not need.
Same goes for ones I am missing.


Of course when I run the code, no surprise, it breaks. I'm pretty sure 
required plexus/bootstrapping classes (and/or aether equivalents) are 
missing. Could you point me to how m2eclipse handles this? Is it as 
simple as including a couple plexus jars? Which ones, and/or can you 
point me to the canonical/minimal example?

Thanks again,
Dan



Subject:
Re: Maven Embedder 2.0.4 replacement; Where to start?
From:
Benjamin Bentmann <be...@udo.edu>
Date:
Thu, 24 Feb 2011 21:26:19 +0100
To:
Maven Developers List <de...@maven.apache.org>

Dan Rollo wrote:

 > Can someone point me to a good starting point to learn about how to embed
 > maven 3.x?
 > [...]
 > I'm looking for a "start reading the source in file xxx" to get started
 > with.

http://svn.apache.org/repos/asf/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenImpl.java


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Embedder 2.0.4 replacement; Where to start?

Posted by Benjamin Bentmann <be...@udo.edu>.
Dan Rollo wrote:

> I'm guessing I
> need the class: org.sonatype.aether.RepositoryCache, but I've no idea
> which jars to include to provide it (and it's deps...).

http://mavencentral.sonatype.com/#search|ga|1|fc%3A%22org.sonatype.aether.RepositoryCache%22

https://docs.sonatype.org/display/AETHER/Home

> Of course when I run the code, no surprise, it breaks. I'm pretty sure
> required plexus/bootstrapping classes (and/or aether equivalents) are
> missing. Could you point me to how m2eclipse handles this? Is it as
> simple as including a couple plexus jars? Which ones, and/or can you
> point me to the canonical/minimal example?

An ordinary Maven 3.x distribution should give a pretty good idea of 
what JARs are needed to run Maven. Also, the source files I mentioned in 
the previous mails give examples how to boot a plexus container.


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Embedder 2.0.4 replacement; Where to start?

Posted by Dan Rollo <da...@gmail.com>.
On 03/11/2011 12:57 AM, Dan Rollo wrote:
> Maven Embedder

Sorry, meant to include a code snippet and stack trace. I'm guessing I 
need the class: org.sonatype.aether.RepositoryCache, but I've no idea 
which jars to include to provide it (and it's deps...).


The trace below is cause by:

         final MavenExecutionRequest mavenExecutionRequest = new 
DefaultMavenExecutionRequest();



java.lang.NoClassDefFoundError: org/sonatype/aether/RepositoryCache
	at 
net.sourceforge.cruisecontrol.sourcecontrols.Maven2SnapshotDependency.getMvnEmbedder(Maven2SnapshotDependency.java:699)
	at 
net.sourceforge.cruisecontrol.sourcecontrols.Maven2SnapshotDependency.getSnapshotInfos(Maven2SnapshotDependency.java:329)
	at 
net.sourceforge.cruisecontrol.sourcecontrols.Maven2SnapshotDependencyTest.testGetPomXml(Maven2SnapshotDependencyTest.java:189)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at 
com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:109)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
Caused by: java.lang.ClassNotFoundException: 
org.sonatype.aether.RepositoryCache
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	... 19 more





Thanks for these links Benjamin. I'm working on converting the old 2.0.4 
embedder code, and I managed to get things to compile by reading the 
imports/code in the m2eclipse link you sent, adding jars to my classpath 
and tweaking calls, wash, rinse, repeat. So far I have the following 
jars on the classpath:

maven-artifact-3.0.3.jar
maven-compat-3.0.3.jar
maven-core-3.0.3.jar
maven-embedder-3.0.3.jar
maven-model-3.0.3.jar
maven-model-builder-3.0.3.jar

Please holler if you see any I should not need.
Same goes for ones I am missing.


Of course when I run the code, no surprise, it breaks. I'm pretty sure 
required plexus/bootstrapping classes (and/or aether equivalents) are 
missing. Could you point me to how m2eclipse handles this? Is it as 
simple as including a couple plexus jars? Which ones, and/or can you 
point me to the canonical/minimal example?

Thanks again,
Dan



Subject:
Re: Maven Embedder 2.0.4 replacement; Where to start?
From:
Benjamin Bentmann <be...@udo.edu>
Date:
Thu, 24 Feb 2011 21:26:19 +0100
To:
Maven Developers List <de...@maven.apache.org>

Dan Rollo wrote:

 > Can someone point me to a good starting point to learn about how to embed
 > maven 3.x?
 > [...]
 > I'm looking for a "start reading the source in file xxx" to get started
 > with.

http://svn.apache.org/repos/asf/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenImpl.java


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org