【发布时间】:2018-04-12 14:39:44
【问题描述】:
Maven 插件及其在父 pom 中定义的依赖项,我不希望我的子 pom 包含该插件依赖项。
例如,如果有 1 个父级和 100 个子级,则 99 个使用该插件并希望在一个子级中排除该插件。
我们如何实现这一目标?
【问题讨论】:
标签: maven
Maven 插件及其在父 pom 中定义的依赖项,我不希望我的子 pom 包含该插件依赖项。
例如,如果有 1 个父级和 100 个子级,则 99 个使用该插件并希望在一个子级中排除该插件。
我们如何实现这一目标?
【问题讨论】:
标签: maven
I found the answer. In parent pom, we should include child details as in below to remove this plugin dependency in child.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExclude>${child-dependency-groupId}:${child-dependency-artifactId}</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</plugin>
</plugins>
【讨论】:
不要在<plugins> 部分配置插件,您应该在<pluginManagement> 中完成这项工作
【讨论】: