如何从报告 Maven 插件中排除依赖项? cobertura-maven-plugin
烦人地拉进来ch.qos.logback:logback-classic
这会在构建和运行期间导致多个 SLF4J 绑定(bind)警告。我尝试插入 <dependencies>
与 <exclusions>
添加到插件,但 Maven 出于某种原因不允许在 <reporting>
中使用它部分。任何帮助表示赞赏。相关的POM如下。
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
最佳答案
这是旧的,但我会给出我的解决方案,以防其他人遇到这个确切的问题。在我的 poms 中,我插入了以下内容
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
</dependencies>
在我的 Cobertura 插件的定义中。 Cobertura 无论如何都在使用 1.1.7(在我的例子中)检查你的 Artifact 以确认,你只需要在创建插件时明确告诉 maven 提取那个版本,否则它仍然会提取冲突的版本并显示错误
关于java - 如何排除 Maven <reporting> 插件中的依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31794924/