zDev - M2E - OSS
  1. zDev - M2E - OSS
  2. MNGECLIPSE-1649

Source attachment for jar-dependencies with classifier inconsistent with Maven

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Global Rank:
      1123

      Description

      When executing mvn eclipse:eclipse DdownloadSources the sources for a dependency with classifier are downloaded as: <i>artifactId</i><i>version</i><i>classifier</i>-sources.jar. M2Eclipse, when assigning the source attachement, however, ignores the classifier and attaches the sources from <i>artifactId</i><i>version</i>-sources.jar.

        Activity

        Hide
        mwinkels added a comment - - edited

        The description is a bit unclear due to formatting:

        When executing mvn eclipse:eclipse – DdownloadSources the sources for a dependency with classifier are downloaded as: artifactIdversionclassifier – sources.jar. M2Eclipse, when assigning the source attachement, however, ignores the classifier and attaches the sources from artifactIdversion – sources.jar.

        Show
        mwinkels added a comment - - edited The description is a bit unclear due to formatting: When executing mvn eclipse:eclipse – DdownloadSources the sources for a dependency with classifier are downloaded as: artifactId – version – classifier – sources.jar. M2Eclipse, when assigning the source attachement, however, ignores the classifier and attaches the sources from artifactId – version – sources.jar.
        Hide
        mwinkels added a comment -

        A workaround for this issue is to add the sources as additional dependencies in the pom (as was custom for maven 1), thus with classifier=sources (ignoring the classifier for the normal jar dependency). This will also fix the source attachment in Eclipse.

        Show
        mwinkels added a comment - A workaround for this issue is to add the sources as additional dependencies in the pom (as was custom for maven 1), thus with classifier=sources (ignoring the classifier for the normal jar dependency). This will also fix the source attachment in Eclipse.
        Hide
        Igor Fedorenko added a comment -

        As far as I know, maven-source-plugin only creates two classified artifacts, -sources and -test-sources, and there is no way to change that. Can you point me to projects that has sources deployed differently? Do you by any chance know how these projects get built and deployed?

        http://maven.apache.org/plugins/maven-source-plugin/

        Show
        Igor Fedorenko added a comment - As far as I know, maven-source-plugin only creates two classified artifacts, -sources and -test-sources, and there is no way to change that. Can you point me to projects that has sources deployed differently? Do you by any chance know how these projects get built and deployed? http://maven.apache.org/plugins/maven-source-plugin/
        Hide
        mwinkels added a comment - - edited

        I don't know anything about maven – source – plugin and I have not looked at it. I have looked at using M2Eclipse to download sources for dependencies that have a classifier and it does not work.

        I've uploaded an artifact with a classifier to our nexus repository and I wanted to add the sources, so they could be picked up by M2Eclipse. Now the behaviour as described above occured:

        When I added the sources to my local repository as – sources (without classifier), M2Eclipse attached the sources correctly. When I then added them to the Nexus, M2Eclipse could not download them, neither could mvn eclipse:eclipse – DdownloadSources, which looked for – classifier – sources

        When I added the sources to Nexus using – classifier – sources, I could download them with mvn eclipse:eclipse – DdownloadSources, but M2Eclipse did not associate the sources correctly.

        Thus although it is an interesting discussion what maven – source – plugin should or should not do, the erroneous behavior was found without having anything to do with that.

        Show
        mwinkels added a comment - - edited I don't know anything about maven – source – plugin and I have not looked at it. I have looked at using M2Eclipse to download sources for dependencies that have a classifier and it does not work. I've uploaded an artifact with a classifier to our nexus repository and I wanted to add the sources, so they could be picked up by M2Eclipse. Now the behaviour as described above occured: When I added the sources to my local repository as – sources (without classifier), M2Eclipse attached the sources correctly. When I then added them to the Nexus, M2Eclipse could not download them, neither could mvn eclipse:eclipse – DdownloadSources, which looked for – classifier – sources When I added the sources to Nexus using – classifier – sources, I could download them with mvn eclipse:eclipse – DdownloadSources, but M2Eclipse did not associate the sources correctly. Thus although it is an interesting discussion what maven – source – plugin should or should not do, the erroneous behavior was found without having anything to do with that.
        Hide
        Igor Fedorenko added a comment -

        Maven core does not model attached artifacts and there is no "standard" way to package/deploy project sources as far as I know. We had to pick a convention how to map artifacts to sources and we picked convention used by maven-source-plugin, as we believe this is the most common way to package and deploy project sources to maven repositories.

        Apparently, maven-eclipse-plugin uses different convention, so I am trying to find more details to see if we can support both conventions in m2e. With all due respect to maven-eclipse-plugin, we can't just change m2e to follow its behaviour without understanding all implications of the change.

        Show
        Igor Fedorenko added a comment - Maven core does not model attached artifacts and there is no "standard" way to package/deploy project sources as far as I know. We had to pick a convention how to map artifacts to sources and we picked convention used by maven-source-plugin, as we believe this is the most common way to package and deploy project sources to maven repositories. Apparently, maven-eclipse-plugin uses different convention, so I am trying to find more details to see if we can support both conventions in m2e. With all due respect to maven-eclipse-plugin, we can't just change m2e to follow its behaviour without understanding all implications of the change.
        Hide
        Steve Armstrong added a comment -

        maven-eclipse-plugin has never worked for us for projects that have a jar classifier. If the issue I filed is accepted, then m2e's behaviour might become standard for both systems: http://jira.codehaus.org/browse/MECLIPSE-675

        Show
        Steve Armstrong added a comment - maven-eclipse-plugin has never worked for us for projects that have a jar classifier. If the issue I filed is accepted, then m2e's behaviour might become standard for both systems: http://jira.codehaus.org/browse/MECLIPSE-675

          People

          • Assignee:
            Unassigned
            Reporter:
            Deleted User
            Last Updated By:
            Brian Fox
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Date of First Response: