jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Eclipse Plugin
  • MECLIPSE-665

wrong classpath order generated in .classpath file for transitive dependencies

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.8
  • Fix Version/s: 2.9
  • Component/s: Core : Dependencies resolution and build path (.classpath)
  • Labels:
    None
  • Environment:
    Hide
    - OS : windows XP 2002 SP3

    - java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

    - Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
    Java version: 1.6.0_20
    Java home: C:\homeware\java\jdk1.6.0_20\jre
    Default locale: en_US, platform encoding: Cp1252
    OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

    - Eclipse SDK
    Version: 3.6.0
    Build id: I20100608-0911

    - maven-eclipse-plugin v2.8
    Show
    - OS : windows XP 2002 SP3 - java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing) - Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) Java version: 1.6.0_20 Java home: C:\homeware\java\jdk1.6.0_20\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" - Eclipse SDK Version: 3.6.0 Build id: I20100608-0911 - maven-eclipse-plugin v2.8
  • Patch Submitted:
    Yes

Description

Hi !

It seems the generated ".classpath" file has a transitive dependencies order different from the one defined in the pom.xml.

In ".classpath", the transitive dependencies are before the refering dependency, while in maven build, they are correctly after.

This is particulary a problem with the "patch jars", containing a small fix for one class, which is supposed to be just before the original bugged jar in the classpath.

I have attached a sample illustrating the problem (demo-classpath-order.zip).
There is a client module (my-client), using a dependency (my-dependency), which has been patched (my-patched-dependency)
my-client depends on my-patched-dependency which depends on my-dependency

my-client is successfully build with maven (mvn clean install). The dependency tree is as follows :
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] sample:my-client:jar:1.0-SNAPSHOT
[INFO] - dependencies:my-patched-dependency:jar:1.0-SNAPSHOT:compile
[INFO] - dependencies:my-dependency:jar:1.0-SNAPSHOT:compile
[INFO] ------------------------------------------------------------------------

But if you try to build under eclipse :
1) mvn eclipse:eclipse to generate .classpath and .project

  • > clean under eclipse + build all
    ... There is an error "The method m2() is undefined for the type MyService"

We can see the classpath in .classpath is inverted :
<classpath>
<classpathentry kind="src" path="src/main/java" including="*/.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/dependencies/my-dependency/1.0-SNAPSHOT/my-dependency-1.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/dependencies/my-patched-dependency/1.0-SNAPSHOT/my-patched-dependency-1.0-SNAPSHOT.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>
my-dependency is before my-patched-dependency ! that's the reason why eclipse can not build it...

I tried to fix the maven-eclipse-plugin, to reverse the order (cf. attached file maven-eclipse-plugin_patch_to_2.8.1.zip). It fixes the problem (but what about the side effect ?)

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    demo-classpath-order.zip
    21/Jul/10 12:18 PM
    19 kB
    Bruno DOOLAEGHE
    1. File
      demo-classpath-order/.../.classpath 0.5 kB
    2. File
      demo-classpath-order/my-client/.project 0.4 kB
    3. File
      demo-classpath-order/.../org.eclipse.core.resources.prefs 0.1 kB
    4. XML File
      demo-classpath-order/my-client/pom.xml 1 kB
    5. Java Source File
      demo-classpath-order/.../RunMe.java 0.4 kB
    6. File
      demo-classpath-order/.../RunMe.class 0.5 kB
    7. File
      demo-classpath-order/.../pom.properties 0.1 kB
    8. Java Archive File
      demo-classpath-order/.../my-client-1.0-SNAPSHOT.jar 2 kB
    9. File
      demo-classpath-order/.../.classpath 0.2 kB
    10. File
      demo-classpath-order/.../.project 0.4 kB
    11. XML File
      demo-classpath-order/.../pom.xml 0.6 kB
    12. Java Source File
      demo-classpath-order/.../MyOtherService.java 0.1 kB
    13. Java Source File
      demo-classpath-order/.../MyService.java 0.1 kB
    14. File
      demo-classpath-order/.../MyOtherService.class 0.5 kB
    15. File
      demo-classpath-order/.../MyService.class 0.5 kB
    16. File
      demo-classpath-order/.../pom.properties 0.1 kB
    17. Java Archive File
      demo-classpath-order/.../my-dependency-1.0-SNAPSHOT.jar 3 kB
    18. File
      demo-classpath-order/.../.classpath 0.3 kB
    19. File
      demo-classpath-order/.../.project 0.4 kB
    20. File
      demo-classpath-order/.../org.eclipse.core.resources.prefs 0.1 kB
    21. XML File
      demo-classpath-order/.../pom.xml 0.8 kB
    22. Java Source File
      demo-classpath-order/.../MyService.java 0.3 kB
    23. File
      demo-classpath-order/.../MyService.class 0.8 kB
    24. File
      demo-classpath-order/.../pom.properties 0.1 kB
    25. Java Archive File
      demo-classpath-order/.../my-patched-dependency-1.0-SNAPSHOT.jar 2 kB
    Download Zip
    Show
    Zip Archive
    demo-classpath-order.zip
    21/Jul/10 12:18 PM
    19 kB
    Bruno DOOLAEGHE
  2. Hide
    Zip Archive
    maven-eclipse-plugin_patch_to_2.8.1.zip
    21/Jul/10 12:18 PM
    2.07 MB
    Bruno DOOLAEGHE
    1. File
      maven-eclipse-plugin/.classpath 6 kB
    2. File
      maven-eclipse-plugin/.project 0.5 kB
    3. File
      maven-eclipse-plugin/.../org.eclipse.jdt.core.prefs 0.3 kB
    4. XML File
      maven-eclipse-plugin/pom.xml 12 kB
    5. Java Source File
      maven-eclipse-plugin/.../AbstractWorkspaceMojo.java 2 kB
    6. Java Source File
      maven-eclipse-plugin/.../AddMavenRepoMojo.java 2 kB
    7. Java Source File
      maven-eclipse-plugin/.../BuildCommand.java 6 kB
    8. Java Source File
      maven-eclipse-plugin/.../ConfigureWorkspaceMojo.java 3 kB
    9. Java Source File
      maven-eclipse-plugin/src/.../Constants.java 1 kB
    10. Java Source File
      maven-eclipse-plugin/.../EclipseCleanMojo.java 6 kB
    11. Java Source File
      maven-eclipse-plugin/.../EclipseConfigFile.java 3 kB
    12. Java Source File
      maven-eclipse-plugin/.../EclipsePlugin.java 74 kB
    13. Java Source File
      maven-eclipse-plugin/.../EclipseSourceDir.java 10 kB
    14. Java Source File
      maven-eclipse-plugin/.../EclipseToMavenMojo.java 27 kB
    15. Java Source File
      maven-eclipse-plugin/.../InstallPluginsMojo.java 16 kB
    16. Java Source File
      maven-eclipse-plugin/.../LinkedResource.java 4 kB
    17. Java Source File
      maven-eclipse-plugin/.../MakeArtifactsMojo.java 5 kB
    18. Java Source File
      maven-eclipse-plugin/src/.../Messages.java 2 kB
    19. Java Source File
      maven-eclipse-plugin/.../MyEclipseCleanMojo.java 0.7 kB
    20. Java Source File
      maven-eclipse-plugin/.../MyEclipsePlugin.java 10 kB
    21. Java Source File
      maven-eclipse-plugin/.../AbstractEclipseOsgiPlugin.java 4 kB
    22. Java Source File
      maven-eclipse-plugin/.../EclipseOsgiPlugin.java 3 kB
    23. Java Source File
      maven-eclipse-plugin/.../ExplodedPlugin.java 3 kB
    24. Java Source File
      maven-eclipse-plugin/.../PackagedPlugin.java 2 kB
    25. Java Source File
      maven-eclipse-plugin/.../RadCleanMojo.java 6 kB
    26. Java Source File
      maven-eclipse-plugin/src/.../RadPlugin.java 14 kB
    27. Java Source File
      maven-eclipse-plugin/.../ReadWorkspaceLocations.java 24 kB
    28. Java Source File
      maven-eclipse-plugin/.../RemoveCacheMojo.java 4 kB
    29. Java Source File
      maven-eclipse-plugin/.../WorkspaceConfiguration.java 3 kB
    30. Java Source File
      maven-eclipse-plugin/.../AbstractEclipseManifestWriter.java 12 kB
    Showing 30 of 1846 items Download Zip
    Show
    Zip Archive
    maven-eclipse-plugin_patch_to_2.8.1.zip
    21/Jul/10 12:18 PM
    2.07 MB
    Bruno DOOLAEGHE

Issue Links

duplicates

Bug - A problem which impairs or prevents the functions of the product. MECLIPSE-388 Correct classpath ordering in .classpath

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jean-Noel Rouvignac added a comment - 29/May/11 2:50 PM

I think the issue is not a reverted order for transitive de[endencies, but simply that the maven eclipse plugin sorts the dependencies alphabetically.

So in my opinion, the current bug is a duplicate of MECLIPSE-388 .

Show
Jean-Noel Rouvignac added a comment - 29/May/11 2:50 PM I think the issue is not a reverted order for transitive de[endencies, but simply that the maven eclipse plugin sorts the dependencies alphabetically. So in my opinion, the current bug is a duplicate of MECLIPSE-388 .
Hide
Permalink
Barrie Treloar added a comment - 22/Sep/11 1:16 AM

As noted by someone else this looks like a duplicate

Show
Barrie Treloar added a comment - 22/Sep/11 1:16 AM As noted by someone else this looks like a duplicate

People

  • Assignee:
    Barrie Treloar
    Reporter:
    Bruno DOOLAEGHE
Vote (1)
Watch (4)

Dates

  • Created:
    21/Jul/10 12:18 PM
    Updated:
    22/Sep/11 1:16 AM
    Resolved:
    22/Sep/11 1:16 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.