Reputation: 1148
I have the following in my pom.xml to enable the sonar plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7.1</version>
</plugin>
I also have set the property to define my server which runs on port 80:
<properties>
<sonar.host.url>http://sonar.for.truelocal.com.au/</sonar.host.url>
</properties>
When running this from my Bamboo server, all is well and analysis is sent to the server.
I then wanted to run a preview report in my local environment. My local environment is a Mac 10.11.2 with Java 7 behind a proxy server.
I added some extra properties to my dev Maven profile:
<sonar.analysis.mode>preview</sonar.analysis.mode>
<sonar.issuesReport.console.enable>true</sonar.issuesReport.console.enable>
<sonar.issuesReport.html.enable>true</sonar.issuesReport.html.enable>
Unfortunately the sonar step fails with the following:
[DEBUG] Create : /Users/w26702/.sonar/cache/_tmp
[DEBUG] Extract sonar-runner-batch in temp...
[DEBUG] Get bootstrap index...
[DEBUG] Download: http://sonar.for.truelocal.com.au/batch_bootstrap/index
[DEBUG] Get bootstrap completed
[DEBUG] Download http://sonar.for.truelocal.com.au/batch/sonar-batch-shaded-5.2.jar to /Users/w26702/.sonar/cache/_tmp/fileCache3157929989449184462.tmp
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default) on project truelocal-api: Fail to download libraries from server: Fail to download sonar-batch-shaded-5.2.jar to /Users/w26702/.sonar/cache/_tmp/fileCache3157929989449184462.tmp: timeout: Read timed out -> [Help 1]
Note that last line is specifies a different plugin to what I quoted above in my pom. This is because after org.codehaus.mojo 2.7.1 didn't work I switched to org.sonarsource.scanner.maven 3.0.1 but it did not make any difference.
I logged on to my sonarqube server and tailed by access log while i was running the build and I actually see the requests for /batch_bootstrap/index and /batch/sonar-batch-shaded-5.2.jar with HTTP 200 OKs.
It seems that the index is received back but the .jar is not.
I then just manually browsed the jar address in my web browser and it is downloaded correctly.
I then disconnected from the corporate network and instead tethered to my phone which has no proxy.
When running like this, the jars are downloaded and the analysis runs without issue.
When I put my machine back behind the proxy, the analysis continues to run without issue because the jars have now been successfully downloaded.
So my question is, is there a bug with the plugin downloading the jars when behind a proxy?
I can't rule out the possibility of my corporate network causing the issue but other jars including the sonar-maven-plugin jar itself do not have issues.
My Sonarqube server version is 5.1-1 on Amazon Linux with a PostgreSQL backend.
Upvotes: 1
Views: 3325
Reputation: 393
This version of sonar-maven-plugin does not seems able to get proxy parameters from Maven settings.xml
So you need to provide proxy parameter with javaOpts :
For example:
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar -Dhttp.proxyHost=proxy.mycompagny.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.mycompagny.com -Dhttps.proxyPort=8080
Upvotes: 4
Reputation: 5326
Some users already reported that some corporate proxy are filtering content based on user agent. That may explain why you are allowed to download the JAR from your browser and not from Maven.
Upvotes: 0