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

Add exclude*, parameters to copy mojo (analogous to copy-dependencies mojo)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.1
    • None
    • copy
    • None

    Description

      Today I came around a use case that I miss in the copy goal/mojo of the dependency plugin. Currently, it is not possible (at least I could not find any documentation) to resolve transitive dependencies when copying an artifact nor to specify whether transitive dependencies should be included or excluded. This should be extended analogous to the copy-dependencies mojo.

      Example: Say we want to copy Retrotranslator including its dependencies. Currently we would have to use the following declarations

      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <executions>
      <execution>
      <id>copy</id>
      <phase>package</phase>
      <goals>
      <goal>copy</goal>
      </goals>
      <configuration>
      <artifactItems>
      <artifactItem>
      <groupId>net.sf.retrotranslator</groupId>
      <artifactId>retrotranslator-runtime</artifactId>
      <version>${retrotranslator-version}</version>
      <type>jar</type>
      <outputDirectory>${project.build.directory}</outputDirectory>
      </artifactItem>
      <!-- Transitive dependency of Retrotranslator. Unfortunately, not automatically included. -->
      <artifactItem>
      <groupId>backport-util-concurrent</groupId>
      <artifactId>backport-util-concurrent</artifactId>
      <version>3.1</version>
      <type>jar</type>
      <outputDirectory>${project.build.directory}</outputDirectory>
      </artifactItem>
      </artifactItems>
      </configuration>
      </execution>
      </executions>
      </plugin>

      This has the downside that all dependencies must be explicitly listed and artifact versions must be kept consistent, which is "unwished maintenance work". More convenient would be a declaration as follows

      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <executions>
      <execution>
      <id>copy</id>
      <phase>package</phase>
      <goals>
      <goal>copy</goal>
      </goals>
      <configuration>
      <artifactItems>
      <artifactItem>
      <groupId>net.sf.retrotranslator</groupId>
      <artifactId>retrotranslator-runtime</artifactId>
      <version>${retrotranslator-version}</version>
      <type>jar</type>
      <outputDirectory>${project.build.directory}</outputDirectory>

      <!-- Force to include all transitive dependencies. They should be copied to the same output directory. -->
      <excludeTransitive>false</excludeTransitive>

      </artifactItem>
      </artifactItems>
      </configuration>
      </execution>
      </executions>
      </plugin>

      Attachments

        Activity

          People

            brianf Brian E Fox
            twwwt Thorsten Möller
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: