I got some progress.
Steps
DIDN'T change anything in sonar/conf/sonar.properties, wrapper.properties, sonar-runner/conf/sonar-runner.properties. MADE sure the host url value is same in sonar.properties and sonar-runner.properties.
Go to the workspace (where you have source code installed).
Ran sonar-runner (an executable) - it will show the path/file It gave the error that I need sonar-project.properties as I was missing some variables required by Sonar.
Used the link
Found SCM Provider not set. Used the link: http://jira.codehaus.org/browse/ACT-1714 to resolve it.
ran sonar-runner again, it went fine. (NOTE: This command is different than running sonarRunner as that's Gradle's sonar runner task).
Went to SonarQube dashboard and there's stuff showing now.
PENDING for tomorrow:
- To the following at Linux command line and from Jenkins (job calling gradle tasks). gradle clean build jacocoTestReport sonarRunner
Update:
- Tried running:
gradle clean build jacocoTestReport - works
gradle clean build jacocoTestReport sonarRunner -- Fails saying src/main/java doesn't exist
gradle clean build jacocoTestReport sonarRunner -Dsonar.sources=src/java -- WORKED
gradle clean build jacocoTestReport sonarRunner -Dsonar.sources="src/java,test/java,src/java-test" -- DID NOT WORKED (PermGen java error)
gradle clean build jacocoTestReport sonarRunner -Dsonar.sources="src/java" -- DID NOT WORKED (PermGen java error)
gradle clean build jacocoTestReport sonarRunner -Dsonar.sources=src/java -- DID NOT WORKED (PermGen java error)
gradle sonarRunner -Dsonar.sources=src/java,test/java,src/java-test -- DID NOT WORKED (Error is charset can't read or import - charset UTF-8 or whatever I end up setting for sonar.sourceEncoding)
gradle clea build jacocoTestReport -- WORKED
then
gradle sonarRunner -Dsonar.sources="src/java" -- WORKED
I have tried setting MaxPernGen in sonar/conf/wrapper.properties to various values like 128, 512, 1024, 2048, ... upto 8000m ... didn't work in resolving the following error - while running all gradle tasks in one command.
:sonarRunner FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarRunner'.
> java.lang.OutOfMemoryError: PermGen space
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Wondering why I'm getting this error as soon as I run:
:gradle clean build jacocoTestReport sonarRunner"
OK - got PermGen Memory issue resolved.
Steps: 1. In my ~/.bashrc or ~/.bash_profile. I created the following variable
GRADLE_OPTS=” -XX:MaxPermSize=512m"
Run "which gradle" or basically find which gradle file (shell or .bat) is used. Go to that path and open "gradle" / "gradle.bat" (for windows) file.
Make the following changes.
DEFAULT_JVM_OPTS="$JAVA_OPTS $GRADLE_OPTS"
Do ". ~/.bash_profile" or ". ~/.bashrc" .... --OR open a new putty session.
Make sure PATH variable has gradle HOME / bin in it (Linux/Windows)
Ran the following command (this time didn't show PermGen error which I got earlier) from workspace:
gradle clean build jacocoTestReport sonarRunner
:) Time to go home early today.
Other similar variables are: GRADLE_OPTS / JAVA_OPTS / SONAR_RUNNER_OPTS (where -XX:Max.. value can be set) at server(putty session level) or in IDEs or in Jenkins.
Thanks Allyn for the hint.