Automatically derive mandatory SonarQube properties from pom file in Jenkins

前端 未结 2 1398
故里飘歌
故里飘歌 2021-01-02 03:39

Situation:

I want to analyze my project with SonarQube (5.4) triggered by Jenkins (1.642.4). It is a java project build with maven.

I see tw

2条回答
  •  甜味超标
    2021-01-02 04:15

    Using SonarQube Scanner as a post build step you can configure it with at least this properties in Analysis properties:

    sonar.projectKey=${POM_ARTIFACTID}
    sonar.projectName=${POM_DISPLAYNAME}
    sonar.projectVersion=${POM_VERSION}
    sonar.sources=src
    sonar.java.binaries=target
    sonar.language=java
    sonar.sourceEncoding=UTF-8
    

    POM_* variables are mapped by Jenkins from Maven GAV info, look here: https://github.com/jenkinsci/jenkins/pull/933/files

提交回复
热议问题