We have seen how to use various code quality tools to perform static code analysis. Let us now see how we can update our site documentation with reports from these tools.
Use the following steps to generate code quality reports for a site:
reporting
section of the pom.xml
file:<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>3.3</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.13</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>3.0.0</version> </plugin>>
mvn test site
For each of the code quality tools specified in the reporting
section of the pom.xml
file, the site
goal runs the specified tool, generates the report, and links to the site documentation.
Clicking on each of the links takes the user to the specific report.
If you have chosen to use SonarQube for analysis and want to link the Sonar report to the site documentation, then you can do the following:
pom.xml
file:<plugin> <groupId>org.codehaus.sonar-plugins</groupId> <artifactId>maven-report</artifactId> <version>0.1</version> </plugin>
mvn test site
A new Sonar link is present in Project Reports, which automatically redirects to the default Sonar installation. The link can be customized to the appropriate URL, if it is different.
18.188.198.94