Prerequisites:
Docker
SonarQube
Anypoint Studio
Installation of Docker:
Installation of mule sonar plugin:
https://github.com/mulesoft-catalyst/mule-sonarqube-plugin#server
- On successful installation of docker run the below command to install mule sonar plugin
docker pull fperezpa/mulesonarqube:7.7.3
- On successful installation of sonar run the following command to start the sonar.
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 fperezpa/mulesonarqube:7.7.3
- On Docker, screen sonar status can be seen
On a Successful run and once the Sonar is Up.
Call http://localhost:9000 on the browser.
Pass credentials below
username: admin
Password: admin
Static Code Check:
Update the properties with
<sonar.sources>src/</sonar.sources>
- Update profiles to connect with sonar.
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.host.url>
http://localhost:9000
</sonar.host.url>
</properties>
</profile>
</profiles>
- Run the following command at project exists where pom.xml exists.
mvn sonar:sonar
- On successful build at http://lolcahost:9000/projects, you can see the project got created with static code check.