We are using sonar runner 2.3 to analyze java code.
sonar-runner gets stuck at one of our projects. The last message on the console reads Java AST Scan and process gets stuck at that..
[jsaluja#[Proj1]] ~/sonar-runner-2.3/bin/sonar-runner
SonarQube Runner 2.3
Java 1.6.0_21 Sun Microsystems Inc. (64-bit)
Linux 2.6.18-238.5.1.el5 amd64
INFO: Runner configuration file: /home/jsaluja/sonar-runner-2.3/conf/sonar-runner.properties
INFO: Project configuration file: /home/jsaluja/0809/Proj1/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /home/jsaluja/0809/Proj1/.sonar
INFO: SonarQube Server 3.6.2
15:53:51.076 INFO - Load batch settings
15:53:51.197 INFO - User cache: /home/jsaluja/.sonar/cache
15:53:51.201 INFO - Install plugins
15:53:52.129 INFO - Install JDBC driver
15:53:52.137 INFO - Create JDBC datasource for jdbc:oracle:thin:#1.2.3.4/XE
15:53:54.574 INFO - Initializing Hibernate
15:53:57.857 INFO - Load project settings
15:53:58.157 INFO - Apply project exclusions
15:53:58.440 INFO - ------------- Scan Module1
15:53:58.444 INFO - Load module settings
15:54:00.618 INFO - Quality profile : [name=Sonar way,language=java]
15:54:00.631 INFO - Excluded tests:
15:54:00.631 INFO - **/package-info.java
15:54:00.703 INFO - Configure Maven plugins
15:54:00.764 INFO - Compare to previous analysis
15:54:00.783 INFO - Compare over 5 days (2013-08-11)
15:54:00.796 INFO - Compare over 30 days (2013-07-17)
15:54:00.968 INFO - Base dir: /home/jsaluja/0809/Proj1/Module1
15:54:00.968 INFO - Working dir: /home/jsaluja/0809/Proj1/.sonar/a.b.c.d_Module1
15:54:00.968 INFO - Source dirs: /home/jsaluja/0809/Proj1/Module1/src
15:54:00.968 INFO - Source encoding: UTF-8, default locale: en_US
15:54:01.221 INFO - Sensor JavaSourceImporter...
15:54:11.517 INFO - Sensor JavaSourceImporter done: 10296 ms
15:54:11.518 INFO - Sensor JavaSquidSensor...
15:54:11.618 INFO - Java AST scan...
I have waited for over 2 hours.
The project structure
Proj1
Module1
Module2
sonar-project.properties
# required metadata
sonar.projectKey=a.b.c.d:Proj1
sonar.projectName=Proj1
sonar.projectVersion=1234
# List of the module identifiers
sonar.modules=Module1,Module2
Related
We have recently updated our SonarQube version from 5.0 to 5.3 and our SonarQube Scanner/Runner from 2.3 to 2.4.
During this upgrade, SonarQube has stopped analyzing our GitHub pull requests. We run the SonarQube Scanner as the last step in our jenkins job.
The command we run is as follows:
/usr/local/sonar-runner/bin/sonar-runner -Dsonar.analysis.mode=issues \
-Dsonar.github.pullRequest=${ghprbPullId} \
-Dsonar.github.repository=OurRepository/OurRepository \
-Dsonar.github.login=MyUsername \
-Dsonar.github.oauth=MyToken \
-Dsonar.login=MyUsername \
-Dsonar.password=MyPassword \
-Dsonar.sources=./app/ \
-Dsonar.projectKey=MyProject \
-Dsonar.projectName=MyProject \
-Dsonar.projectVersion=2.9.0 \
-Dsonar.exclusions=app/Vendor/**,app/Plugin/**/Test/**,app/Test/**
The only thing we changed during this upgrade is the analysis mode. Before the upgrade we used the incremental mode which has been removed in 5.2.
The output of the command is as follows:
+ /usr/local/sonar-runner/bin/sonar-runner -Dsonar.analysis.mode=issues -Dsonar.github.pullRequest=2944 -Dsonar.github.repository=OurRepository/OurRepository -Dsonar.github.login=Username -Dsonar.github.oauth=MyToken -Dsonar.login=MyUsername -Dsonar.password=MyPAsword -Dsonar.sources=./app/ -Dsonar.projectKey=MyProject -Dsonar.projectName=MyProject -Dsonar.projectVersion=2.9.0 '-Dsonar.exclusions=app/Vendor/**,app/Plugin/**/Test/**,app/Test/**'
SonarQube Runner 2.4
Java 1.7.0_101 Oracle Corporation (64-bit)
Linux 3.10.0-327.13.1.el7.x86_64 amd64
INFO: Runner configuration file: /usr/local/sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: /projectpath/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /projectpath/./.sonar
INFO: SonarQube Server 5.3
12:54:00.422 INFO - Load global repositories
12:54:00.927 INFO - Load global repositories (done) | time=505ms
12:54:00.988 INFO - User cache: /projectpath/.sonar/cache
12:54:01.016 INFO - Exclude plugins: devcockpit, jira, pdfreport, views, report, buildstability, buildbreaker, scmstats
12:54:01.417 INFO - Load plugins index
12:54:01.431 INFO - Load plugins index (done) | time=14ms
12:54:02.121 INFO - Found project [MyProject] cache [Thu May 19 11:29:15 CEST 2016]
12:54:02.280 INFO - Process project properties
12:54:02.723 INFO - Load project repositories
12:54:03.461 INFO - Load project repositories (done) | time=738ms
12:54:03.485 INFO - Apply project exclusions
12:54:03.629 INFO - Load quality profiles
12:54:04.348 INFO - Load quality profiles (done) | time=719ms
12:54:04.357 INFO - Load active rules
12:54:09.383 INFO - Load active rules (done) | time=5026ms
12:54:09.401 INFO - Issues mode
12:54:09.401 INFO - Scanning only changed files
12:54:09.405 INFO - ------------- Scan MyProject
12:54:10.217 INFO - Language is forced to php
12:54:10.238 INFO - Load server rules
12:54:11.104 INFO - Load server rules (done) | time=866ms
12:54:11.233 INFO - Base dir: /projectpath/workspace
12:54:11.233 INFO - Working dir: /projectpath/.sonar
12:54:11.235 INFO - Source paths: app
12:54:11.235 INFO - Source encoding: UTF-8, default locale: en_US
12:54:11.236 INFO - Index files
12:54:11.265 INFO - Excluded sources:
12:54:11.266 INFO - app/Vendor/**
12:54:11.266 INFO - app/Plugin/**/Test/**
12:54:11.266 INFO - app/Test/**
12:54:11.266 INFO - app/Test/**
12:54:11.266 INFO - Included tests:
12:54:11.266 INFO - app/Test/**
12:54:16.551 INFO - 983 files indexed
12:54:16.552 INFO - 12296 files ignored because of inclusion/exclusion patterns
12:54:16.661 INFO - Quality profile for php: Sonar way
12:54:17.180 INFO - JaCoCoSensor: JaCoCo report not found : /projectpath/target/jacoco.exec
12:54:17.183 INFO - JaCoCoItSensor: JaCoCo IT report not found: /projectpath/target/jacoco-it.exec
12:54:17.220 INFO - Sensor NoSonar and Commented out LOC Sensor
12:54:17.926 INFO - Sensor NoSonar and Commented out LOC Sensor (done) | time=706ms
12:54:17.926 INFO - Sensor Lines Sensor
12:54:18.161 INFO - Sensor Lines Sensor (done) | time=235ms
12:54:18.162 INFO - Sensor PHPSensor
12:54:18.894 INFO - 509 source files to be analyzed
12:54:28.909 INFO - 265/509 files analyzed, current file: /projectpath/MyFile.php
12:54:38.479 INFO - Sensor PHPSensor (done) | time=20317ms
12:54:38.479 INFO - Sensor PHPUnit Sensor
12:54:38.479 INFO - 509/509 source files have been analyzed
12:54:38.480 INFO - PHPUnit xml test report not found: app/junit-output.xml
12:54:38.480 INFO - PHPUnit xml unit test coverage report not found: app/clover-coverage.xml
12:54:38.480 INFO - No PHPUnit integration test coverage report provided (see 'sonar.php.coverage.itReportPath' property)
12:54:38.480 INFO - No PHPUnit overall coverage report provided (see 'sonar.php.coverage.overallReportPath' property)
12:54:38.480 INFO - Sensor PHPUnit Sensor (done) | time=1ms
12:54:38.480 INFO - Load server issues
12:54:40.752 INFO - Load server issues (done) | time=2272ms
12:54:40.753 INFO - Performing issue tracking
12:54:43.215 INFO - 1210/1210 components tracked
12:54:43.216 INFO - ANALYSIS SUCCESSFUL
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 45.188s
Final Memory: 7M/215M
INFO: ------------------------------------------------------------------------
Does anyone have any idea why this upgrade has stopped the SonarQube scanner from commenting/analyzing our pull request?
Duh, we forgot to install the github plugin on our new SonarQube instance...
The command output should include:
Starting analysis of pull request:
https://github.com/Organization/OurRepository/pull/2940
If it doesn't, you're most likely missing the github plugin.
Using SonarQube 5.2 with Sonar-Java-Plugin 3.8, and for analysis Sonar-Runner 2.4 is used.
Plugin and java-custom examples are downloaded from git (https://github.com/SonarSource/sonar-examples/tree/master/plugins/java-custom-rules), built and deployed on server, and rules are visible on the server. Rules were activated using web under "Sonar Way" profile (which is default). A new test profile is also created and rule "Avoid Brand in method name" is added to it, and associated a project to it.
While analyzing sample java code from (/src/test/files), issues from all default java rules are locked on server, but no issue for the custom rules are locked. There are no explicit error in logs either.
sonar-runner.properties
sonar.host.url=http://localhost:9000
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar52?useUnicode=true&characterEncoding=utf8
sonar.jdbc.username=root
sonar.jdbc.password=ChangeIt
sonar.projectKey=TestSonarCustomRules
sonar.projectName=TestSonarCustomRules
sonar.projectVersion=1.0
sonar.sources=E:/Sonar Example/sonar-examples-master/plugins/java-custom-rules/src/test/files/
Here are the analysis logs:
E:\sonar-runner-2.4
SonarQube Runner 2.4
Java 1.8.0_45 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
INFO: Runner configuration file: E:\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: E:\Sonar Example\sonar-examples-master\plugins\java-custom-rules\src\test\files\.\.sonar
INFO: SonarQube Server 5.2
18:56:49.391 INFO - Load global repositories
18:56:49.539 INFO - Load global repositories (done) | time=145ms
18:56:49.557 WARN - Property 'sonar.jdbc.url' is not supported any more. There is no more DB connection to the SQ database. It will be ignored.
18:56:49.558 WARN - Property 'sonar.jdbc.username' is not supported any more. There is no more DB connection to the SQ database. It will be ignored.
18:56:49.558 WARN - Property 'sonar.jdbc.password' is not supported any more. There is no more DB connection to the SQ database. It will be ignored.
18:56:49.560 INFO - User cache: C:\Users\kapil.saxena\.sonar\cache
18:56:49.777 INFO - Load plugins index
18:56:49.781 INFO - Load plugins index (done) | time=4ms
18:56:49.960 INFO - Process project properties
18:56:50.209 INFO - Load project repositories
18:56:50.290 INFO - Load project repositories (done) | time=81ms
18:56:50.298 INFO - Apply project exclusions
18:56:50.369 INFO - Load quality profiles
18:56:50.401 INFO - Load quality profiles (done) | time=32ms
18:56:50.403 INFO - Load active rules
18:56:50.478 INFO - Load active rules (done) | time=75ms
18:56:50.498 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
18:56:50.499 INFO - Publish mode
18:56:50.500 INFO - ------------- Scan TestSonarCustomRules
18:56:50.582 INFO - Load server rules
18:56:50.630 INFO - Load server rules (done) | time=48ms
18:56:50.683 INFO - Base dir: E:\Sonar Example\sonar-examples-master\plugins\java-custom-rules\src\test\files
18:56:50.683 INFO - Working dir: E:\Sonar Example\sonar-examples-master\plugins\java-custom-rules\src\test\files\.sonar
18:56:50.685 INFO - Source paths: .
18:56:50.685 INFO - Source encoding: windows-1252, default locale: en_US
18:56:50.686 INFO - Index files
18:56:50.758 INFO - 7 files indexed
18:56:50.760 INFO - Quality profile for java: Kapil Test Profile
18:56:50.786 INFO - Sensor JavaSquidSensor
18:56:50.925 INFO - Configured Java source version: none
18:56:50.954 INFO - JavaClasspath initialization...
18:56:50.954 INFO - JavaClasspath initialization done: 0 ms
18:56:50.954 INFO - JavaTestClasspath initialization...
18:56:50.954 INFO - JavaTestClasspath initialization done: 0 ms
18:56:51.232 INFO - Java Main Files AST scan...
18:56:51.234 INFO - 7 source files to be analyzed
18:56:51.631 INFO - 7/7 source files have been analyzed
18:56:51.632 INFO - Java Main Files AST scan done: 400 ms
18:56:51.632 WARN - Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor#3a5c2626 are disabled.
18:56:51.632 INFO - Java Test Files AST scan...
18:56:51.632 INFO - 0 source files to be analyzed
18:56:51.632 INFO - Java Test Files AST scan done: 0 ms
18:56:51.632 INFO - 0/0 source files have been analyzed
18:56:51.632 INFO - Sensor JavaSquidSensor (done) | time=846ms
18:56:51.633 INFO - Sensor Lines Sensor
18:56:51.635 INFO - Sensor Lines Sensor (done) | time=2ms
18:56:51.635 INFO - Sensor QProfileSensor
18:56:51.640 INFO - Sensor QProfileSensor (done) | time=5ms
18:56:51.640 INFO - Sensor SurefireSensor
18:56:51.641 INFO - parsing E:\Sonar Example\sonar-examples-master\plugins\java-custom-rules\src\test\files\target\surefire-reports
18:56:51.641 ERROR - Reports path not found or is not a directory: E:\Sonar Example\sonar-examples-master\plugins\java-custom-rules\src\test\files\target\surefire-reports
18:56:51.641 INFO - Sensor SurefireSensor (done) | time=1ms
18:56:51.641 INFO - Sensor SCM Sensor
18:56:51.641 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
18:56:51.641 INFO - Sensor SCM Sensor (done) | time=0ms
18:56:51.641 INFO - Sensor Code Colorizer Sensor
18:56:51.642 INFO - Sensor Code Colorizer Sensor (done) | time=1ms
18:56:51.642 INFO - Sensor CPD Sensor
18:56:51.642 INFO - JavaCpdEngine is used for java
18:56:51.682 INFO - Sensor CPD Sensor (done) | time=40ms
18:56:51.752 INFO - Analysis reports generated in 68ms, dir size=9 KB
18:56:51.873 INFO - Analysis reports compressed in 121ms, zip size=11 KB
18:56:51.912 INFO - Analysis reports sent to server in 38ms
18:56:51.913 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/TestSonarCustomRules
18:56:51.913 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
18:56:51.913 INFO - More about the report processing at http://localhost:9000/api/ce/task?id=AVGl0nT8XJ_fdu5L48WL
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS INFO:
------------------------------------------------------------------------
Total time: 3.290s Final Memory: 14M/325M INFO:
------------------------------------------------------------------------
sonar, access and wrapper logs are all clean.
Here's image from SonarQube web showing issues for AvoidBrandInMethodNamesChecks, where all default issues are locked but issues against custom rule are not locked:
Issues for AvoidBrandInMethodNamesCheck
Any help would be appreciated.
Debug statements from custom plugin code were not executed when analysis was done with logging level at verbose/DEBUG.
The behaviour was the same when analysis was done using SonarQube 5.1 / 5.2 / 5.3 against databases default embedded H2 / PostgreSQL 9.5
Finally worked. I was using wrong version of examples. My pom.xml file of java-custom-rules did not have the following:
<dependency>
<groupId>org.sonarsource.java</groupId>
<artifactId>java-squid</artifactId>
<version>${java.plugin.version}</version>
</dependency>
Note: Get the latest version of examples.
After migrating our project from sonarqube 5.0.1 to 5.1.2 we get no results after analysing. I gues its because sonar runner is indexing 0 files....The configuration, like basedir, didnt change. Does anyone having an idea?
Build step 'Invoke Gradle script' changed build result to SUCCESS
[workspace] $ C:\Users\Jenkins\.jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarRunner\bin\sonar-runner.bat -e -Dsonar.jdbc.url=jdbc:postgresql://localhost/sonar ******** ******** -Dsonar.host.url=http://zaphod:9000/ ******** ******** -Dsonar.projectBaseDir=C:\Users\Jenkins\.jenkins\jobs\KISSsoftCRM_develop\workspace -Dsonar.sources=src/api,src/main -Dsonar.junit.reportsPath=build/test-results -Dsonar.jacoco.reportPath=build/jacoco/test.exec -Dsonar.jacoco.reportMissing.force.zero=true -Dsonar.projectVersion=1.0.0 -Dsonar.java.binaries=build/classes -Dsonar.modules=CRMUtil -Dsonar.projectKey=com.kisssoft.crm.util -Dsonar.java.libraries=build/libs -Dsonar.java.coveragePlugin=jacoco -Dsonar.projectName=CRMUtil_develop
C:\Users\Jenkins\.jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarRunner
SonarQube Runner 2.4
Java 1.8.0_25 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Users\Jenkins\.jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarRunner\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "de_DE", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: C:\Users\Jenkins\.jenkins\jobs\KISSsoftCRM_develop\workspace\.sonar
INFO: SonarQube Server 5.1.2
14:35:00.881 INFO - Load global repositories
14:35:01.213 INFO - Load global repositories (done) | time=334ms
14:35:01.215 INFO - Server id: 20150802141341
14:35:01.218 INFO - User cache: C:\Users\Jenkins\.sonar\cache
14:35:01.228 INFO - Install plugins
14:35:01.283 INFO - Install JDBC driver
14:35:01.293 INFO - Create JDBC datasource for jdbc:postgresql://localhost/sonar
14:35:04.103 INFO - Initializing Hibernate
14:35:06.921 INFO - Load project repositories
14:35:07.002 INFO - Load project repositories (done) | time=81ms
14:35:07.002 INFO - Load project settings
14:35:08.261 INFO - Load technical debt model
14:35:08.287 INFO - Apply project exclusions
14:35:08.975 INFO - ------------- Scan CRMUtil
14:35:08.981 INFO - Load module settings
14:35:09.162 INFO - Load rules
14:35:09.230 INFO - Base dir: C:\Users\Jenkins\.jenkins\jobs\KISSsoftCRM_develop\workspace\CRMUtil
14:35:09.230 INFO - Working dir: C:\Users\Jenkins\.jenkins\jobs\KISSsoftCRM_develop\workspace\.sonar\com.kisssoft.crm.util_CRMUtil
14:35:09.231 INFO - Source paths: src/api, src/main
14:35:09.232 INFO - Source encoding: windows-1252, default locale: de_DE
14:35:09.232 INFO - Index files
14:35:09.265 INFO - 0 files indexed
14:35:09.751 INFO - Sensor Lines Sensor
14:35:09.753 INFO - Sensor Lines Sensor (done) | time=2ms
14:35:09.753 INFO - Sensor QProfileSensor
14:35:09.770 INFO - Sensor QProfileSensor (done) | time=17ms
14:35:09.770 INFO - Sensor InitialOpenIssuesSensor
14:35:09.791 INFO - Sensor InitialOpenIssuesSensor (done) | time=21ms
14:35:09.791 INFO - Sensor ProjectLinksSensor
14:35:09.801 INFO - Sensor ProjectLinksSensor (done) | time=10ms
14:35:09.801 INFO - Sensor VersionEventsSensor
14:35:10.115 INFO - Sensor VersionEventsSensor (done) | time=314ms
14:35:10.115 INFO - Sensor SCM Sensor
14:35:10.115 INFO - SCM Sensor is disabled
14:35:10.115 INFO - Sensor SCM Sensor (done) | time=0ms
14:35:10.115 INFO - Sensor CPD Sensor
14:35:10.115 INFO - Sensor CPD Sensor (done) | time=0ms
14:35:10.147 INFO - Loaded quality gate 'SonarQube way'
14:35:10.204 INFO - Compare to previous analysis (2015-08-02)
14:35:10.212 INFO - Compare over 30 days (2015-07-03, analysis of Tue Jun 30 23:09:17 CEST 2015)
14:35:10.215 INFO - Compare to previous version (2015-07-28)
14:35:11.237 INFO - Execute decorators...
14:35:11.745 INFO - ------------- Scan CRMUtil_develop
14:35:11.746 INFO - Load module settings
14:35:11.772 INFO - Base dir: C:\Users\Jenkins\.jenkins\jobs\KISSsoftCRM_develop\workspace
14:35:11.772 INFO - Working dir: C:\Users\Jenkins\.jenkins\jobs\KISSsoftCRM_develop\workspace\.sonar
14:35:11.772 INFO - Source encoding: windows-1252, default locale: de_DE
14:35:11.776 INFO - Sensor Lines Sensor
14:35:11.776 INFO - Sensor Lines Sensor (done) | time=0ms
14:35:11.776 INFO - Sensor InitialOpenIssuesSensor
14:35:11.782 INFO - Sensor InitialOpenIssuesSensor (done) | time=6ms
14:35:11.783 INFO - Sensor ProjectLinksSensor
14:35:11.786 INFO - Sensor ProjectLinksSensor (done) | time=2ms
14:35:11.786 INFO - Sensor VersionEventsSensor
14:35:11.793 INFO - Sensor VersionEventsSensor (done) | time=7ms
14:35:11.793 INFO - Sensor SCM Sensor
14:35:11.793 INFO - SCM Sensor is disabled
14:35:11.793 INFO - Sensor SCM Sensor (done) | time=0ms
14:35:11.793 INFO - Sensor CPD Sensor
14:35:11.793 INFO - Sensor CPD Sensor (done) | time=0ms
14:35:11.819 INFO - Loaded quality gate 'SonarQube way'
14:35:11.823 INFO - Compare to previous analysis (2015-08-02)
14:35:11.825 INFO - Compare over 30 days (2015-07-03, analysis of Tue Jun 30 23:09:17 CEST 2015)
14:35:11.827 INFO - Compare to previous version (2015-07-28)
14:35:13.311 INFO - Execute decorators...
14:35:13.527 INFO - Store results in database
14:35:13.792 INFO - Analysis reports generated in 41ms, dir size=169 bytes
14:35:13.815 INFO - Analysis reports compressed in 22ms, zip size=777 bytes
14:35:13.853 INFO - Analysis reports sent to server in 38ms
14:35:13.853 INFO - ANALYSIS SUCCESSFUL, you can browse http://zaphod:9000/dashboard/index/com.kisssoft.crm.util
14:35:13.853 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
You probably forget to copy extensions/plugins from the old install to the new one. As a result you don't have any language plugin installed. Please provide server startup logs to confirm.
Yes we are building it against Java 8 on Jenkins.
This is the configuration:
sonar.projectKey=com.kisssoft.crm.util
sonar.projectName=CRMUtil_develop
sonar.projectVersion=1.0.0
sonar.sources=src/api,src/main
# sonar.tests=src/test
sonar.modules=CRMUtil
sonar.junit.reportsPath=build/test-results
sonar.jacoco.reportPath=build/jacoco/test.exec
sonar.jacoco.reportMissing.force.zero=true
sonar.java.coveragePlugin=jacoco
sonar.java.binaries=build/classes
sonar.java.libraries=build/libs
When i have a look at the base dir it seems correct in my opinion
it seems that SonarQube is missing the needed plugins. I have faced the same issue, but after installing them through settings->Update Center everything worked fine.
please check the same with your configuration and install all required plugins within Sonarqube.
I am struggling with the following problem.
Log of the executed when sonar-runner in Jenkins.
SonarQube Runner 2.4
Java 1.7.0_67 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
SONAR_RUNNER_OPTS=-Xms256m -Xmx512m
INFO: Runner configuration file: D:\CI_BUILD\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "ko_KR", source code encoding: "UTF-8"
INFO: Work directory: D:\CI_BUILD\jenkins_home\jobs\CAFE-CLIENT\workspace\.sonar
INFO: SonarQube Server 4.5
05:17:52.119 INFO - Load global referentials...
05:17:53.382 INFO - Load global referentials done: 1263 ms
05:17:53.414 INFO - User cache: C:\Users\pcms_build\.sonar\cache
05:17:53.445 INFO - Install plugins
05:17:54.225 INFO - Install JDBC driver
05:17:54.303 INFO - Create JDBC datasource for jdbc:jtds:sqlserver://10.240.232.145/sonardb;SelectMethod=Cursor
05:17:56.222 INFO - Initializing Hibernate
05:17:59.217 INFO - Load project referentials...
05:18:19.232 INFO - Load project referentials done: 20015 ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 34.757s
Final Memory: 21M/291M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to request: /batch/project?key=CAFE-CLIENT&preview=false
ERROR: Caused by: Read timed out
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
05:18:19.232 INFO - Load project referentials done: 20015 ms
When "Load project referentials done" value is larger than 20,000 ms,
Always "Read timed out" occurs.
Loading of project referentials is not expected to take more than a few seconds. It is very likely you have a performance issue on your SQ server (or with your DB). Here are some criteria that may increase duration of this web service:
you have installed a lot of language plugins or you have enabled a lot of rules in quality profiles
your project is a multi-module project with a lot of modules
Compare for example with:
http://nemo.sonarqube.org/batch/project?key=org.codehaus.sonar%3Asonar&preview=true
that returns more than 1000 rules and 33 modules. It takes less than 2 seconds to return data.
EDIT: it seems there was some SQL issues depending on your DB vendor. See http://jira.codehaus.org/browse/SONAR-5849 and http://jira.codehaus.org/browse/SONAR-6063. Should be fixed in upcoming 4.5.3
I am trying to analyse Java project using SOnar 3.7 & sonar-runner 2.3.
I was successfully able to analyse same codebase using Sonar 3.6.1 & Sonar runner 2.2.1 with same rule set/profile.
However, when I have upgraded version then I am having following errors...
org.jdom.IllegalDataException: The data "null" is not legal for a JDO
M attribute: A null is not a legal XML value
Console Output :
SonarQube Runner 2.3 Java 1.6.0_30 Sun Microsystems Inc. (64-bit) Windows 7 6.1 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Dhruba\InstallationFolder\Sonar\sonar-runner-2.3\conf\sonar-runner.properties
INFO: Project configuration file: C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\.sonar
INFO: SonarQube Server 3.7
13:38:29.376 INFO - Load batch settings
13:38:29.482 INFO - User cache: C:\Users\Dhruba\.sonar\cache
13:38:29.487 INFO - Install plugins
13:38:31.219 INFO - Install JDBC driver
13:38:31.227 INFO - Create JDBC datasource for jdbc:oracle:thin:#localhost:1521 /orcl
13:38:32.382 INFO - Initializing Hibernate 13:38:34.579 INFO - Load project settings
13:38:34.665 INFO - Apply project exclusions
13:38:34.788 INFO - ------------- Scan OPSBankIIUtilityService
13:38:34.790 INFO - Load module settings
13:38:35.382 INFO - Quality profile : [name=OBBase1,language=java]
13:38:35.394 INFO - Excluded sources:
13:38:35.394 INFO - **/*_*.java
13:38:35.394 INFO - **/bo/**
13:38:35.395 INFO - */stub/**
13:38:35.395 INFO - **/*FacadeSoap*.java
13:38:35.395 INFO - com.ibm.ejs.container._EJSWrapper_**/src
13:38:35.395 INFO - *_Deser/src
13:38:35.395 INFO - *Proxy.java
13:38:35.395 INFO - */*FacadeHome.java
13:38:35.395 INFO - */*FacadeLocalHome.java 13:38:35.395 INFO - com/elsevier/obii/xml/*
13:38:35.395 INFO - Excluded tests:
13:38:35.395 INFO - */package-info.java
13:38:35.430 INFO - Configure Maven plugins
13:38:35.502 INFO - Compare to previous analysis
13:38:35.532 INFO - Compare over 7 days (2013-09-14)
13:38:35.558 INFO - Compare to previous version
13:38:35.734 INFO - Base dir: C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\OPSBankIIUtilityService
13:38:35.734 INFO - Working dir: C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\.sonar\dhrsrvc_OPSBankIIUtilityService
13:38:35.735 INFO - Source dirs: C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\OPSBankIIUtilityService\src
13:38:35.735 INFO - Source encoding: windows-1252, default locale: en_US
13:38:36.090 INFO - Sensor JavaSourceImporter...
13:38:37.021 INFO - Sensor JavaSourceImporter done: 931 ms
13:38:37.021 INFO - Sensor JavaSquidSensor...
13:38:37.160 INFO - Java AST scan...
13:38:40.518 INFO - Java AST scan done: 3358 ms
13:38:40.763 INFO - Sensor JavaSquidSensor done: 3742 ms
13:38:40.764 INFO - Sensor SurefireSensor...
13:38:40.765 INFO - parsing C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\.sonar\dhrsrvc_OPSBankIIUtilityService\build\surefire-reports
13:38:40.767 INFO - Sensor SurefireSensor done: 3 ms
13:38:40.769 INFO - Sensor CpdSensor...
13:38:40.770 INFO - SonarEngine is used
13:38:40.846 INFO - Cross-project analysis disabled
13:38:41.511 INFO - Sensor CpdSensor done: 742 ms
13:38:41.511 INFO - Sensor CheckstyleSensor...
13:38:41.514 INFO - Execute Checkstyle 5.6...
13:38:41.534 INFO - Checkstyle configuration: C:\Dhruba\Projects\Elsevier-OPSBANK_II_AIS\R11_Service_Workspace\.sonar\dhrsrvc_OPSBankIIUtilityService\checkstyle.xml
13:38:43.845 INFO - Execute Checkstyle 5.6 done: 2331 ms
13:38:43.849 INFO - Sensor CheckstyleSensor done: 2338 ms
13:38:43.850 INFO - Sensor PmdSensor...
13:38:43.853 INFO - Execute PMD 4.3...
13:38:43.864 INFO - Java version: 1.5
13:38:44.008 INFO - Execute PMD 4.3 done: 155 ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 17.761s Final Memory: 15M/406M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:90)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:41) Caused by: org.sonar.api.utils.XmlParserException: org.jdom.IllegalDataException : The data "null" is not legal for a JDOM attribute: A null is not a legal XML value.
at org.sonar.plugins.pmd.PmdSensor.analyse(PmdSensor.java:55)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:142)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:186)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:181)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:179)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:174)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:156)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:144)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
**Caused by: org.jdom.IllegalDataException: The data "null" is not legal for a JDO M attribute: A null is not a legal XML value.**
at org.jdom.Attribute.setValue(Attribute.java:486)
at org.jdom.Attribute.<init>(Attribute.java:229)
at org.jdom.Attribute.<init>(Attribute.java:252)
at org.jdom.Element.setAttribute(Element.java:1109)
at org.sonar.plugins.pmd.PmdProfileExporter.exportPmdRulesetToXml(PmdProfileExporter.java:126)
at org.sonar.plugins.pmd.PmdProfileExporter.exportProfile(PmdProfileExporter.java:63)
at org.sonar.plugins.pmd.PmdExecutor.createRulesets(PmdExecutor.java:107)
at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:89)
at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:75)
at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:61)
at org.sonar.plugins.pmd.PmdSensor.analyse(PmdSensor.java:52)
... 37 more ERROR: ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Can you please help to resolve this one ?
I was analyzing the issue and found that imported profile from Sonar 3.6.1 to 3.7 had issue. Sonar 3.7 was not able to parse few of the XPath rules.
Therefore, I have just removed those XPath rules and re-added them manually and it starts working. This issue is not a bug of Sonar-runner instead Sonar 3.7 could not restore profiles correctly.