maven 3 embedded

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

maven 3 embedded

Roberts, Lawrence
hi

i'm trying to update my application using the maven 2 embedder to maven 3,
and i cannot get the plexus component system to resolve/lookup the
components outside of my unit tests, ie. when the same code is executed
from a shell.

i have gone through the source code for the hudson/jenkins plugin, the
maven-core (3.0.3) unit tests, the maven-embedder (3.0.3) MavenCli
classes, and attempted to configure things in the ways they do and it
still does not work, mostly with this error:

org.codehaus.plexus.component.repository.exception.ComponentLookupException
: java.util.NoSuchElementException
      role: org.apache.maven.Maven


some more info:
- the mavenexecutionrequest building etc. all works, it's just when i get
to the plexusContainer.lookup(Maven.class) that it fails.
- in brief i create my container like:

  this.classWorld = new ClassWorld( "plexus.core",
Thread.currentThread().getContextClassLoader() );
  ContainerConfiguration containerConfiguration = new
DefaultContainerConfiguration()
            .setClassWorld(this.classWorld)
            .setRealm( setupContainerRealm( ) )
            .setName( "maven" );
  this.container = new DefaultPlexusContainer( containerConfiguration );



- i can successfully lookup a Maven instance in my maven unit tests
(within my maven build)
- in the standalone app plexus can find *my* components, but not mavens
  - i have tried copying the contents of the maven-core
META-INF/plexus/components.xml to my components.xml, no luck
- most of the plexus guides concerning the class loading/resolving pieces
are empty: http://plexus.codehaus.org/guides/developer-guide/index.html

it all points to a classloading issue, but i know the required maven
classes are on the classpath (albeit in separate jars) as when i remove
the jar i get a classnotfoundexception as you would expect.

anyway, i've been pulling my hair out for a few days now and so any help
is greatly appreciated.

thanks
larry



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]