Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
2.1
-
None
-
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>