ops4j / org.ops4j.pax.construct

Build, manage and deploy many types of OSGi bundles
https://ops4j1.jira.com/wiki/display/paxconstruct/Pax+Construct
24 stars 14 forks source link

Maven build crashes in Eclipse [PAXCONSTRUCT-128] #140

Closed ops4j-issues closed 13 years ago

ops4j-issues commented 14 years ago

Former user created PAXCONSTRUCT-128

Since i installed the latest build of the m2eclipse maven plugin and running a maven package/install from the context menu in eclipse i get the following stacktrace:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.maven.project.MavenProject.addPlugin(Lorg/apache/maven/model/Plugin;)V
at org.ops4j.pax.construct.lifecycle.BundleCompilerMojo.mergeCompilerConfiguration(BundleCompilerMojo.java:102)
at org.ops4j.pax.construct.lifecycle.BundleCompilerMojo.execute(BundleCompilerMojo.java:70)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:103)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:477)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:314)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:199)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:460)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:334)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Running the same command on the command line, it doesn't crash. It seems maven changed an interface in the newest version.


Fixed in: 1.5 Votes: 0, Watches: 0

ops4j-issues commented 14 years ago

Alin Dreghiciu commented

Looks to me more like a m2e rather then pax runner so I do not know what can we do about.

ops4j-issues commented 14 years ago

Toni Menzel commented

well its probably org.ops4j.pax.construct.lifecycle.BundleCompilerMojo.mergeCompilerConfiguration(..) accessing org.apache.maven.project.MavenProject.addPlugin(Lorg/apache/maven/model/Plugin;)V

which could be pax constructs problem, no ?

ops4j-issues commented 14 years ago

Alin Dreghiciu commented

@Tony. Right. Moved.

ops4j-issues commented 14 years ago

Toni Menzel commented

Maven Pax Plugin uses 2.0.7 maven api, M2E 3.0-SNAPSHOT but api should be compatible so, probabaly have to check a bit more.

ops4j-issues commented 14 years ago

Stuart McCulloch commented

Pax-Construct attempts to alter the compilation behaviour to better match OSGi, and to do this it relies on various Maven APIs which I guess have changed.

As a workaround look in the "poms/pom.xml" file and change:

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.ops4j</groupId>
          <artifactId>maven-pax-plugin</artifactId>
          <!--
           | enable improved OSGi compilation support for the bundle life-cycle.
           | to switch back to the standard bundle life-cycle, move this setting
           | down to the maven-bundle-plugin section
          -->
          <extensions>true</extensions>                        <!-- MOVE THIS -->
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>1.4.3</version>
        </plugin>
      </plugins>
    </pluginManagement>

to be:

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.ops4j</groupId>
          <artifactId>maven-pax-plugin</artifactId>
          <!--
           | enable improved OSGi compilation support for the bundle life-cycle.
           | to switch back to the standard bundle life-cycle, move this setting
           | down to the maven-bundle-plugin section
          -->
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>1.4.3</version>
          <extensions>true</extensions>                        <!-- TO HERE -->
        </plugin>
      </plugins>
    </pluginManagement>

ie. move the <extensions> element from the maven-pax-plugin to the maven-bundle-plugin.
This will disable the Pax-Construct compilation mojo and re-enable standard compilation.

ops4j-issues commented 14 years ago

Former user commented

I changed the poms/pom.xml as you mentioned it. it gave me a similar Exception.

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.maven.project.MavenProject.getGoalConfiguration(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/codehaus/plexus/util/xml/Xpp3Dom;
at org.apache.felix.bundleplugin.JarPluginConfiguration.getPluginConfiguration(JarPluginConfiguration.java:74)
at org.apache.felix.bundleplugin.JarPluginConfiguration.getCorePluginConfiguration(JarPluginConfiguration.java:68)
at org.apache.felix.bundleplugin.JarPluginConfiguration.getArchiveConfiguration(JarPluginConfiguration.java:52)
at org.apache.felix.bundleplugin.BundlePlugin.mergeMavenManifest(BundlePlugin.java:453)
at org.apache.felix.bundleplugin.BundlePlugin.buildOSGiBundle(BundlePlugin.java:397)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:273)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:227)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:218)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:103)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:477)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:314)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:199)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:460)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:334)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

ops4j-issues commented 14 years ago

Stuart McCulloch commented

This last exception (getGoalConfiguration) can be solved by upgrading to m2e 0.9.9_200911171109 or later, see https://issues.apache.org/jira/browse/FELIX-1601 for more details.

ops4j-issues commented 13 years ago

Andreas Pieber commented

ok, maven3 creates the same error and is also fixable with the same workaround; the question is: is there any way to permanently fix this problem?

ops4j-issues commented 13 years ago

Stuart McCulloch commented

Fixed in r17101