Domanda

I develop java application using Eclipse IDE and Windows OS.

I have this problem: From cmd my maven task works good but if I invoke it from eclipse - I see build failure

I want to use maven with configuration from cmd in my eclipse.

I made following steps: enter image description here

enter image description here

C:\>set m2_home
M2_HOME=C:\Program Files\apache\apache-maven-3.1.1

I want to perform the same actions as from cmd only from Eclipse.

Can you help me?

update - problem demonstration

from Eclipse:

I invoke so:enter image description here

result:

...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.273s
[INFO] Finished at: Thu Apr 03 18:39:58 MSK 2014
[INFO] Final Memory: 91M/782M
...

from cmd:

D:\work\ct\ctc-core>mvn clean install
.....
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:01.446s
[INFO] Finished at: Thu Apr 03 18:42:48 MSK 2014

update

if I add -X in maven command from eclipse

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.161s
[INFO] Finished at: Thu Apr 03 19:09:16 MSK 2014
[INFO] Final Memory: 91M/752M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (generate-scr-descriptor) on project ctc-core-import: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: Comparison method violates its general contract! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (generate-scr-descriptor) on project ctc-core-import: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: Comparison method violates its general contract!
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: Comparison method violates its general contract!
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at java.util.TimSort.mergeLo(TimSort.java:747)
    at java.util.TimSort.mergeAt(TimSort.java:483)
    at java.util.TimSort.mergeForceCollapse(TimSort.java:426)
    at java.util.TimSort.sort(TimSort.java:223)
    at java.util.TimSort.sort(TimSort.java:173)
    at java.util.Arrays.sort(Arrays.java:659)
    at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:235)
    at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:192)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    ... 21 more
È stato utile?

Soluzione

It looks like it is a compatibility issue when using JDK 7 (or Android) related to behavior when sort routines encounter implementations of Comparable which do not strictly satisfy the interface contract.

If your command line Maven setup using JDK 6, make JDK 6 available in your Eclipse setup (see Prefs->Java->Installed JREs), and make your project use it (Java Build Path->Libraries).

For anyone else wanting to regress to JDK 6 (not recommended), it can be obtained here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top