Maven
  1. Maven
  2. MNG-5122

MavenCli com.google.inject.internal.util.ComputationException: java.lang.NoClassDefFoundError: org/apache/maven/plugin/descriptor/MojoDescriptor

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.0.3
    • Fix Version/s: None
    • Component/s: Class Loading, Embedding
    • Labels:
      None
    • Environment:

      Description

      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

      1. build.log
        3.08 MB
        K. Golbang
      2. components.xml
        140 kB
        K. Golbang
      3. pom.xml
        10 kB
        K. Golbang

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            KG
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development