请使用sonar.java.binaries提供项目的已编译类 [英] Please provide compiled classes of your project with sonar.java.binaries

查看:212
本文介绍了请使用sonar.java.binaries提供项目的已编译类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在多模块项目中遇到错误,结构很简单,看起来像这样:

I am struggling with an error with a multi-modules project, the struture is simple, it looks like this :

 root 
   module a
   module b
   module c
   pom.xml

使用maven命令行后:clean sonar:sonar deploy

After using the maven command line : clean sonar:sonar deploy

我是这个错误:

无法执行目标 org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli)在项目X上:请提供您的已编译类 具有sonar.java.binaries属性的项目-> [帮助1]

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project X : Please provide compiled classes of your project with sonar.java.binaries property -> [Help 1]

这是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <groupId>groupeId</groupId>
    <artifactId>artifactId</artifactId>
    <version>version</version>
    <packaging>pom</packaging>
    <name>${project.artifactId}-parent</name>
    <description>description</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.3.0.603</version>
            </plugin>
        </plugins>
    </build>
    <modules>
        <module>module a</module>
        <module>module b</module>
        <module>module c</module>
    </modules>
</project>

推荐答案

您正在以错误的顺序运行Maven步骤:

You're running your Maven steps in the wrong order:

  • clean-删除所有先前的构建输出
  • sonar:sonar-运行分析(需要构建输出)
  • deploy-构建& etc ...
  • clean - delete all previous build output
  • sonar:sonar - run analysis (which requires build output)
  • deploy - build &etc...

尝试以下方法:

mvn clean deploy sonar:sonar

现在,如果您要反对的是您不希望真正部署"罐子,除非/除非更改的代码通过了质量门,否则……这需要不同的工作流程:

Now if you're about to object that you don't want to actually "deploy" the jar until/unless the changed code passes the Quality Gate, well... that requires a different workflow:

mvn clean package sonar:sonar
// check quality gate status
// if (qualityGateOk) { deploy }

最后两个步骤的详细信息将取决于您的CI基础结构.但是对于Jenkins,步骤2是很好记录

The particulars of those last two steps will depend on your CI infrastructure. But for Jenkins, step #2 is well documented

这篇关于请使用sonar.java.binaries提供项目的已编译类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆