我的 pom 中有几个依赖项会引入不需要的 jar,因此对它们设置了相同的排除:
<dependencies>
<dependency>
<groupId>some.group</groupId>
<artifactId>some-artifact-1</artifactId>
<version>1</version>
<exclusions>
<exclusion>
<groupId>annoying.group</groupId>
<artifactId>unwanted-artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>some.other.group</groupId>
<artifactId>some-artifact-2</artifactId>
<version>1</version>
<exclusions>
<exclusion>
<groupId>annoying.group</groupId>
<artifactId>unwanted-artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>another.group</groupId>
<artifactId>some-artifact-3</artifactId>
<version>1</version>
<exclusions>
<exclusion>
<groupId>annoying.group</groupId>
<artifactId>unwanted-artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
.
.
.
<dependencies>
Run Code Online (Sandbox Code Playgroud)
问题是我的 poms 有数十个依赖项,因此可能会有更多依赖项拉入不需要的 jar。我不知道如何辨别那些不会带来不必要的依赖的依赖项。
我现在的工作流程是:
我的问题是:有更好的方法吗?有没有办法在我的 pom 中设置一般排除,这样我就不必一遍又一遍地重复相同的排除?或者是否有更好的工作流程来排除这个不需要的 jar?
我正在使用 Maven 3.0.4