- Take mysql dump and copy the sql file to the other machine
> mysqldump -u root -p --opt [database name] > [database name].sql
- Drop and create clean database
> mysql -u root -p
> DROP DATABASE [database name];
> CREATE DATABASE [database name];
> mysql -u root -p [database name] < /path/to/[database name].sql
PreRequisite:
Sonar Plugin Installation for Jenkins
Outside Internal Network
- Navigate to Jenkins > Manage Jenkins > Manage Plugins > Available
- Search "Sonar Plugin" and install the same.
- Restart Jenkins.
Inside Internal Network
- Navigate to Jenkins > Manage Jenkins > Manage Plugins > Advanced
- Type the proxy details inside "HTTP Proxy Configuration" and follow the steps for "Outside Internal Network".
OR
- Find the latest sonar plugin https://updates.jenkins-ci.org/download/plugins/sonar/.
- Save the downloaded *.hpi/*.jpi file for Sonar Plugin.
- Navigate to Jenkins > Manage Jenkins > Manage Plugins > Advanced > Upload Plugin
- Upload the downloaded *.hpi/*.jpi file for Sonar Plugin into Jenkins.
- Restart Jenkins.
OR
- Save the downloaded *.hpi/*.jpi file into the $JENKINS_HOME/plugins directory and Restart Jenkins.
- Restart Jenkins.
Add SonarQube Server Details
- Navigate to Jenkins > Manage Jenkins > Configure System.
- Find the Keyword "Sonar" and check for Sonar Installation and Click on "Add Sonar > Advanced..."
- Fill the fields
- Name : <Sonar name, whatever you want to>
- Server URL :
- Sonar account login :
- Sonar account password:
- Database URL : (say jdbc:mysql://localhost:3306/sonar)
- Database login :
- Database password :
- Database driver : (say com.mysql.jdbc.Driver)
- Click "Save".
Add Sonar-Runner Details
- Navigate to Jenkins > Manage Jenkins > Configure System.
- Find the Keyword "Sonar Runner" and check for "Sonar Runner Installation" and Click on "Add Sonar Runner"
- Fill the fields
- Name : <Sonar Runner name, whatever you want to>
- SONAR_RUNNER_HOME : <Sonar Runner Extracted Directory path>
- Click "Save".
Sonar Analysis via Jenkins
- Navigate to Jenkins > Job (Already created before say SampleJob)
- Click on link "SampleJob"
- In the left navigation Menu, click "Configure".
- Click to "Add build step", a list will open
- Then click "Invoke Standalone Sonar Analysis".
- Add the details to run Sonar.
- Run the Jon (SampleJob).
SonarQube (previously known as "Sonar") Install
SonarQube (previously known as "Sonar")
- Download and extract the latest sonarqube.zip http://dist.sonar.codehaus.org/sonarqube-x.x.zip.
- Edit <install_directory>/conf/sonar.properties to configure the database settings.
Say DB available for sonar is mysql then
sonar.jdbc.username=sonaruser
sonar.jdbc.password=sonarpwd
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar
[Better to uncomment above lines in the default sonar.properties file]
More advance features (as host, port, context, java options, proxy...) can be edited in this files.
- To start sonarqube on windows 64bit(choose the folder according to your OS).
C:>"<install_directory>\bin\windows-x86-64\StartSonar.bat"
- Install sonarqube as service.
C:>"<install_directory>\bin\windows-x86-64\InstallNTService.bat"
C:>"<install_directory>\bin\windows-x86-64\StartNTService.bat"
Troubleshooting
- I service does not start then
- Open windows services (Window+R > Type services + Enter) and go to SonarQube.
- Open properties > Log On > This account > provide the admin user details for the system.