Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-590

dependency:copy confused when asked to copy artifact with classifier and extension .POM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0, 3.0.1, 3.0.2
    • None
    • copy
    • None

    Description

      Suppose you ask the maven-dependency-plugin to copy an artifact with the following coordinates:

      • groupId: group
      • artifactId: artifact
      • version: 1.0-SNAPSHOT
      • classifier: custom
      • type: pom

      This is done with the following configuration:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>group</groupId>
                  <artifactId>artifact</artifactId>
                  <version>1.0-SNAPSHOT</version>
                  <classifier>custom</classifier>
                  <type>pom</type>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      

      The MOJO will fail to copy the artifact with classifier=custom, type=pom but will instead copy the primary .POM artifact. However, things are ok when type is set to xml instead of pom.
      It seems the mojo totally ignores the classifier whenever the type is pom...

      I have attached a sample project made of two modules to reproduce the issue.
      The first module has an additional artifact of type pom and classifier custom attached to it via the build-helper-maven-plugin
      The second module attempts to copy that additional artifact with the maven-dependency-plugin.
      Run it with mvn package. The result of the copy is in module-b/target/copied-custom.pom.
      It is ecpected this file is a copy of module-a/custom.xml but is actually a copy of the primary pom, ie module-a/pom.xml.

      Attachments

        1. MDEP-590.zip
          2 kB
          Bertrand Renuart

        Activity

          People

            Unassigned Unassigned
            brenuart Bertrand Renuart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: