Configurationpom.xml
If you do not need to pass parameters from the command line, you can specify the corresponding parameters in the pom file,
properties
provide the value of thesonar.host.url
andsonar.login
field 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.xml
the 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:sonar
a configured version of the plugin.