You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Roberts, Lawrence" <La...@ucsf.edu> on 2011/07/19 23:28:29 UTC

maven 3 embedded

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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org