I'm collecting all dependency libraries in a separator folder on mvn package
as follows:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven.copy.plugin}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Problem: this also include <scope>test</scope>
libraries.
How can I exclude these libs?
Use an includeScope
to include only runtime
scoped dependencies:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven.copy.plugin}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
Apparently, <excludeScope>test</excludeScope>
does not seem to be supported because the test
scope covers all dependencies (https://issues.apache.org/jira/browse/MDEP-85).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With