SonarQube tutorial: Scan projects using the sonar-maven-plugin plugin

Configurationpom.xml

If you do not need to pass parameters from the command line, you can specify the corresponding parameters in the pom file, propertiesprovide the value of the sonar.host.urland sonar.loginfield in the field, and log in using token or account password, such as: -Dsonar.login=admin -Dsonar.password=123456. Examples are as follows -

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>

    <sonar.host.url>http://127.0.0.1:9000</sonar.host.url>
    <sonar.login>eef68547ea46d48aaefc472170ec87b833db182f</sonar.login>

</properties>

<plugin>
    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.7.0.1746</version>
</plugin>

Use plugins

In pom.xmlthe same level directory, execute the following command:

mvn sonar:sonar

It is also possible to use mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonara configured version of the plugin.

Guess you like

Origin blog.csdn.net/a772304419/article/details/132757244