MavenCli com.google.inject.internal.util.ComputationException: java.lang.NoClassDefFoundError: org/apache/maven/plugin/descriptor/MojoDescriptor ------------------------------------------------------------------------------------------------------------------------------------------------
Key: MNG-5122 URL: https://jira.codehaus.org/browse/MNG-5122 Project: Maven 2 & 3 Issue Type: Bug Components: Class Loading, Embedding Affects Versions: 2.2.1 Environment: Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) Java version: 1.6.0_16 Java home: C:\Programme\Java\jdk1.6.0_16\jre Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows" Reporter: Kati Golbang Attachments: build.log, components.xml, pom.xml I want to use MavenCli in order to use Maven programatically within an installer (IzPack). pom.xml (see attachment). I'm using <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>3.0-beta-3</version> </dependency> Note that all dependencies are unzipped and part of the final installer jar (target/product-installer.jar). The components.xml contains all available components.xml files (merged by plexus-component-metadata plugin). how to build: mvn -X clean install > build.log At runtime (java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address="8000" -jar target/wigeoweb-installer.jar) following code is executed: MavenCli cli = new MavenCli(); int result = cli.doMain(new String[]{"compile -X"}, "C:/Develop/Experiments/webservercontext-maven-plugin", //Own plugin System.out, System.out); System.out.println("result: " + result); It terminates with exception while initializing plexus container (there's the place where the debugger exits): Exception: Listening for transport dt_socket at address: 8000 [ERROR] Error executing Maven. [ERROR] com.google.inject.internal.util.ComputationException: java.lang.NoClassDefFoundError: org/apache/maven/plugin/descriptor/MojoDescriptor [ERROR] Caused by: java.lang.NoClassDefFoundError: org/apache/maven/plugin/descriptor/MojoDescriptor [ERROR] Caused by: org/apache/maven/plugin/descriptor/MojoDescriptor [ERROR] Caused by: org.apache.maven.plugin.descriptor.MojoDescriptor Source Code: private void container( CliRequest cliRequest ) throws Exception { if ( cliRequest.classWorld == null ) { cliRequest.classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() ); } DefaultPlexusContainer container = this.container; if ( container == null ) { ContainerConfiguration cc = new DefaultContainerConfiguration() .setClassWorld( cliRequest.classWorld ) .setName( "maven" ); *container = new DefaultPlexusContainer( cc ); //<<<<<<<<<<<<<<<<<<<<<< EXCEPTION THROWN* container.setLoggerManager( new MavenLoggerManager( logger ) ); container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() ); customizeContainer( container ); if ( cliRequest.classWorld == classWorld ) { this.container = container; } } maven = container.lookup( Maven.class ); executionRequestPopulator = container.lookup( MavenExecutionRequestPopulator.class ); modelProcessor = createModelProcessor( container ); settingsBuilder = container.lookup( SettingsBuilder.class ); dispatcher = (DefaultSecDispatcher) container.lookup( SecDispatcher.class, "maven" ); } thank you K. Golbang -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira