Maven build crashes in Eclipse

Description

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/PluginV
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.

Environment

Eclipse 3.5, M2E 0.99

Activity

Show:
StuartS
October 12, 2009, 4:48 PM
Edited

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:

to be:

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.

Former user
October 13, 2009, 8:38 AM

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/StringLorg/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)

StuartS
December 6, 2009, 6:29 AM

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.

Andreas Pieber
October 10, 2010, 7:10 PM

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?

StuartS
December 3, 2010, 2:01 PM

Fixed in r17101

Assignee

StuartS

Reporter

Former user

Labels

None

Fix versions

Priority

Major
Configure