Reputation: 1248
I have already assembled all runtime dependencies for my project in one output directory using the Maven Dependency plugin. Now I would like to assemble all additional test dependencies in a separate directory.
But when I include scope test
and exclude either compile
or runtime
scope, it still always copies all compile dependencies as well.
Is there a way to copy only the additional test dependencies?
My current configuration:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-test-libs</id>
<phase>generate-test-resources</phase>
<goals><goal>copy-dependencies</goal></goals>
<configuration>
<outputDirectory>${project.build.directory}/test-libs</outputDirectory>
<includeScope>test</includeScope>
<excludeScope>compile</excludeScope>
<excludeTransitive>true</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 3
Views: 1607
Reputation: 137299
The includeScope
parameter, by default, is empty which means it includes all scopes and the excludeScope
is, by default, empty.
When you specify <includeScope>test</includeScope>
, it means that you want to include all dependencies (of all scopes). This setting seems to be different that the default empty value and I guess the maven-dependency-plugin
is confused when both <excludeScope>
and <includeScope>
are used: it includes everything and does not exclude the specified scopes.
You need to remove includeScope
and let excludeScope
do it's job.
Upvotes: 3