Ivy
  1. Ivy
  2. IVY-770

MakePom task handling of mulitple artifacts for Maven2

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta-2
    • Fix Version/s: 2.2.0
    • Component/s: Maven Compatibility
    • Labels:
      None

      Description

      Maven2 won't create more than one uniquely named artifact for a project, unless you set the packaging to "pom". Then you have a separate pom for each of the artifacts, referencing the project pom with a parent tag. They would get deployed like this:

      /myorg/mymodule/1.0/mymodule-1.0.pom
      /myorg/artifact-core/1.0/artifact-core-1.0.pom
      /myorg/artifact-core/1.0/artifact-core-1.0.jar
      /myorg/artifact-util/1.0/artifact-util-1.0.pom
      /myorg/artifact-util/1.0/artifact-util-1.0.jar

      Resolution: Change MakePom task to build separate poms when it detects multiple uniquely named artifacts.

      1. IVY-770.patch
        37 kB
        Jesper Pedersen
      2. apache-ivy-2.0.0-makepom-with-unit-tests.patch
        10 kB
        Mandie Smith
      3. apache-ivy-2.0.0-makepom.patch
        9 kB
        Paul Wardrip

        Issue Links

          Activity

          Hide
          Paul Wardrip added a comment -

          A patch to handle multiple artifact projects in IvyMakePom

          Show
          Paul Wardrip added a comment - A patch to handle multiple artifact projects in IvyMakePom
          Hide
          Mandie Smith added a comment -

          Attaching an updated patch with source and unit tests

          Show
          Mandie Smith added a comment - Attaching an updated patch with source and unit tests
          Hide
          Maarten Coene added a comment -

          What will happen when the ivy.xml file also declares sources and javadocs artifacts?

          Show
          Maarten Coene added a comment - What will happen when the ivy.xml file also declares sources and javadocs artifacts?
          Hide
          Mandie Smith added a comment -

          I tested adding the following to my ivy.xml publications:

          <publications>
          <artifact type="pom" />
          <artifact type="jar" />
          <artifact m:classifier="sources" type="source" ext="jar" />
          </publications>

          When I generate the pom using the patched ivy code I see filename.jar, filename.pom and filename-sources.jar created. There's no additional pom created for the source jar.

          Show
          Mandie Smith added a comment - I tested adding the following to my ivy.xml publications: <publications> <artifact type="pom" /> <artifact type="jar" /> <artifact m:classifier="sources" type="source" ext="jar" /> </publications> When I generate the pom using the patched ivy code I see filename.jar, filename.pom and filename-sources.jar created. There's no additional pom created for the source jar.
          Hide
          Aaron Hachez added a comment -

          This issue is also in 2.1.0 release

          Show
          Aaron Hachez added a comment - This issue is also in 2.1.0 release
          Hide
          Maarten Coene added a comment -

          I'm not convinced this should be solved like this.
          Ivy supports multiple artifacts for a module, maven does not. Perhaps it's better to raise an exception when trying to convert such a module?

          Mapping multiple artifacts to multiple maven modules isn't the same!

          Using your example: adding a dependency in Ivy on your module is like this:
          <dependency org="myorg" name="mymodule" rev="1.0" />

          But when the POM is created like this, the dependency-declaration must be rewritten to point to the artifacts directly:
          <dependency org="myorg" name="artifact-core" rev="1.0" />
          <dependency org="myorg" name="artifact-util" rev="1.0" />

          Another approach which maybe could solve some (but not all) issue could be making use of the maven-jar-plugin in combination with the 'classifier' element.
          I'm not a maven user, so I don't know if this would help, but maybe it's worth investigating?

          Maarten

          Show
          Maarten Coene added a comment - I'm not convinced this should be solved like this. Ivy supports multiple artifacts for a module, maven does not. Perhaps it's better to raise an exception when trying to convert such a module? Mapping multiple artifacts to multiple maven modules isn't the same! Using your example: adding a dependency in Ivy on your module is like this: <dependency org="myorg" name="mymodule" rev="1.0" /> But when the POM is created like this, the dependency-declaration must be rewritten to point to the artifacts directly: <dependency org="myorg" name="artifact-core" rev="1.0" /> <dependency org="myorg" name="artifact-util" rev="1.0" /> Another approach which maybe could solve some (but not all) issue could be making use of the maven-jar-plugin in combination with the 'classifier' element. I'm not a maven user, so I don't know if this would help, but maybe it's worth investigating? Maarten
          Hide
          Jesper Pedersen added a comment -

          I think it would be easier to start with basic support where the artifact is specified as part of the makepom task.

          And then exclude the mappings that aren't needed for the artifact in question.

          The attached patch implements this JIRA + IVY-1005 , which makes mapping multiple Ivy artifacts to different Maven pom files a lot easier in my view.

          Show
          Jesper Pedersen added a comment - I think it would be easier to start with basic support where the artifact is specified as part of the makepom task. And then exclude the mappings that aren't needed for the artifact in question. The attached patch implements this JIRA + IVY-1005 , which makes mapping multiple Ivy artifacts to different Maven pom files a lot easier in my view.
          Hide
          Jesper Pedersen added a comment -

          New version which allows extra dependencies to be added to the generated pom file. This could f.ex. be other artifacts produced in the Ivy setup.

          Show
          Jesper Pedersen added a comment - New version which allows extra dependencies to be added to the generated pom file. This could f.ex. be other artifacts produced in the Ivy setup.
          Hide
          Jesper Pedersen added a comment -

          Patch updated against trunl (2010/07/19)

          Show
          Jesper Pedersen added a comment - Patch updated against trunl (2010/07/19)
          Hide
          Maarten Coene added a comment -

          I've committed the patch in both trunk and 2.2.x branch.
          Could you please verify?

          thanks a lot for the contribution!
          Maarten

          Show
          Maarten Coene added a comment - I've committed the patch in both trunk and 2.2.x branch. Could you please verify? thanks a lot for the contribution! Maarten
          Hide
          Jesper Pedersen added a comment -

          The "scope" attribute on a <dependency> doesn't get mapped correctly – it turns into an "<optional>true</optional>" instead.

          Also the <repository ... url="xyz"> doesn't get mapped to <url>xyz</url>, but we can take that in another JIRA...

          Show
          Jesper Pedersen added a comment - The "scope" attribute on a <dependency> doesn't get mapped correctly – it turns into an "<optional>true</optional>" instead. Also the <repository ... url="xyz"> doesn't get mapped to <url>xyz</url>, but we can take that in another JIRA...
          Hide
          Jesper Pedersen added a comment -

          I can't read correctly – its the "scope" attribute through

          <mapping conf="myconf" scope="runtime"/>

          instead.

          Show
          Jesper Pedersen added a comment - I can't read correctly – its the "scope" attribute through <mapping conf="myconf" scope="runtime"/> instead.

            People

            • Assignee:
              Maarten Coene
              Reporter:
              Paul Wardrip
            • Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development