1. Add plugin to pom.xml in the project
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.1.1</version>
</plugin>
Execution maven install
install the plugin.
2. Execute the maven command
sonar:sonar -Dsonar.jdbc.driver=com.mysql.jdbc.Driver \
-Dsonar.branch.name=master \
-Dsonar.host.username=admin \
-Dsonar.host.password=admin \
-Dsonar.host.url=http://xxx:9000/sonar \
-Dsonar.projectName=sxpush
sonar.host.url Fill in the sonar server address that can be accessed http://xxx:9000
.
3. Verification
Open http: // xxx: 9000 / sonar to see the sonar of the project.