Reputation: 43
I hava a platform based on sonarqube, when someone commit their java code ,it will trigger sonar scan committed files, use command like :
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.inclusions=/*test1.java,/*test2.java,**/*test3.java -Dsonar.projectKey=aaa -Dsonar.projectName=aaa -Dsonar.branch=aaa
sometimes it works fine, sometimes it get errors like below:
[INFO] Base dir: D:\GITMapping\Vendor.OrderSvc4j
[INFO] Working dir: D:\GITMapping\Vendor.OrderSvc4j\target\sonar
[INFO] Source encoding: UTF-8, default locale: zh_CN
[INFO] Sensor Lines Sensor
[INFO] Sensor Lines Sensor (done) | time=0ms
[INFO] Sensor SCM Sensor
[INFO] Sensor SCM Sensor (done) | time=0ms
[INFO] Sensor SonarJavaXmlFileSensor
[INFO] Sensor SonarJavaXmlFileSensor (done) | time=0ms
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=0ms
[INFO] Sensor Code Colorizer Sensor
[INFO] Sensor Code Colorizer Sensor (done) | time=0ms
[INFO] Sensor CPD Block Indexer
[INFO] Sensor CPD Block Indexer (done) | time=0ms
[INFO] Calculating CPD for 1 files
[INFO] CPD calculation finished
[INFO] Analysis report generated in 181ms, dir size=525 KB
[INFO] Analysis reports compressed in 110ms, zip size=75 KB
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] vendor-ordersvc .................................... FAILURE [01:48 min]
[INFO] vendor-ordersvc-support ............................ SKIPPED
[INFO] vendor-ordersvc-dal ................................ SKIPPED
[INFO] vendor-ordersvc-contract ........................... SKIPPED
[INFO] vendor-ordersvc-ext ................................ SKIPPED
[INFO] vendor-ordersvc-agent .............................. SKIPPED
[INFO] vendor-ordersvc-cache .............................. SKIPPED
[INFO] vendor-ordersvc-biz ................................ SKIPPED
[INFO] vendor-ordersvc-soa ................................ SKIPPED
[INFO] vendor-ordersvc-client ............................. SKIPPED
[INFO] vendor-ordersvc-dotnet-client ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:49 min
[INFO] Finished at: 2018-01-11T18:55:04+08:00
[INFO] Final Memory: 108M/1585M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project vendor-ordersvc: Fail to request http://10.33.20.39:9000/api/ce/submit?projectKey=com.ctrip.tour:vendor-ordersvc&projectName=vendor-ordersvc&projectBranch=6c99fd81ee61f737b49cedfff2080c8ff5d65f45: Read timed out -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Upvotes: 2
Views: 1794
Reputation: 43
I solve this by add -Dsonar.ws.timeout=300 in scan command:
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.inclusions=/*test1.java,/*test2.java,**/*test3.java -Dsonar.projectKey=aaa -Dsonar.projectName=aaa -Dsonar.branch=aaa -Dsonar.ws.timeout=300
Upvotes: 1
Reputation: 1518
Try using this syntax :
mvn -b -U clean install sonar:sonar -Dsonar.host.url= -Dsonar.verbose=true Dsonar.scm.forceReloadAll=true and then add your sonar parameters and connection to your pom.xml ofcourse.
in my case this syntax is always successful.
if it is still not working then my assumption is that your pom.xml is not set correctly.
good luck
Upvotes: 0