java - 如何排除 Maven <reporting> 插件中的依赖项?

标签 java maven dependencies reporting pom.xml

如何从报告 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/

相关文章:

java - 在java中测试文件下载

java - Weblogic 8.1.6常见的依赖有哪些

maven - 如何安静 Maven "props"日志输出?

java - 如何基于 Google Cloud Endpoints 为 API 编写测试?

java - Maven 错误 "Cannot resolve project dependencies:"-- "org.eclipse.jst.web_sdk.feature.feature.group"

c++ - G++/海湾合作委员会 : how to make your app tell OS to download libs it needs into system?

java - jsp 的 Bean 错误 :include

java - springSecurityFilterChain - ObjectPostProcessor 是必需的 bean 异常

java - 如何使用 jaxb 从 wsdl 文件生成 java 类?

java - 如何使用maven插件tomcat7 :run with multiple contexts (WARs)?