So, first let's see how to configure SonarQube with Jenkins so that we can perform static code analysis by triggering it from Jenkins.
Go to Manage Jenkins, click on Manage Plugins, and then click on the Available tab. Find the SonarQube plugin and install it.
Go to Manage Jenkins, and then click on Configure System. Find the SonarQube servers section and click on the Add SonarQube server. Provide Server URL and credentials. Get a Server authentication token from SonarQube (Administration | Security | Users) and provide it in Jenkins:
Go to Global Tool Configuration in Manage Jenkins and configure the SonarQube Scanner to install automatically:
Create a new freestyle job in Jenkins. Configure JDK path of agent where SonarQube is installed.
Install the Quality gate plugin as well. By configuring the Quality gate plugin, we can fail the Jenkins build job if SonarQube analysis...