问题
I'm using the maven-shade-plugin and I'd like to exclude not only my test code, but my test dependencies in the shaded jar. I realize I can specifically exclude certain artifacts (like junit), but that's a good bit of work and prone to some error most likely.
I'm setting minimizeJar
to true, but I still see my Junit and Mockito dependencies showing up. Is there just no way to exclude all test scoped dependencies via configuration?
回答1:
Make sure your test dependencies in the test
scope:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
...
To check if your dependency setup use
mvn dependency:tree
来源:https://stackoverflow.com/questions/16466490/how-to-exclude-test-dependencies-from-a-shaded-maven-jar