We are using Sonarqube - Community Edition Version 7.9.4 in Docker container
And we have Jenkins and SonarQube-Scanner-4.0.0.1744 (both) inside another container
Everything is working as expected and it is scanning all the projects, but suddenly for one project it it throwing an error “java.lang.outofmemoryerror gc overhead limit exceeded sonarqube”.
I have already set the sonar.properties as - “sonar.web.javaOpts=-Xmx1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError”
In our case where do we have to set “SONAR_SCANNER_OPTS” as we have 2 container 1 for sonarqube and other for jenkins + scanner.
In sonar-scanner.properties we have defined - SONAR_SCANNER_OPTS="-Xmx512m"
When you set sonar.web.javaOpts=-Xmx1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError in sonar.properties you updated the server configuration. To alter the memory available to analysis, you’ll need to set SONAR_SCANNER_OPTS on the Jenkins side.
As you suggested I have tried to provide SONAR_SCANNER_OPTS on Jenkins side, But after that when I executing the scan then it is throwing different error.
I have set SONAR_SCANNER_OPTS="-Xmx1024m" as environment in jenkins container.
But now it is throwing “Error: Could not find or load main class “-Xmx1024m””
This doesn’t seem related to the error message you’re getting, but one thing I notice is that you have spaces in your command line between -D and the key/value pairs. E.G. instead of -D sonar.projectKey=Ecosmod.btifixloy-web.PR-33 it should be -Dsonar.projectKey=Ecosmod.btifixloy-web.PR-33.
This probably won’t make a difference, but how about fixing all those spaces & trying again, just to eliminate that variable.