javamavensonarqubehudsonhudson-plugins

Hudson SonarPlugin fails if MAVEN_OPTS are set in build job


I configured a post build sonarqube analysis with the hudson SonarPlugin. I configured the MAVEN_OPTS for the SonarPlugin to be like this: "-Xmx1024m -Dmaven.javadoc.failOnError=false"

If I run the job there is an error when hudson tries to execute the post build action:

[workspace] $ mvn -f /home/hudson-3.3.0/jobs/myJob/workspace/pom.xml -e -B sonar:sonar -Dsonar.jdbc.driver=oracle.jdbc.OracleDriver -Dsonar.jdbc.url=jdbc:oracle:thin:@xxxxx:1521/xxxx ******** ******** -Dsonar.host.url=http://xxxx:9000/sonar
Error: Could not find or load main class MAVEN_OPTS
Sonar analysis completed: FAILURE

I use the following setup:
Tomcat 8.0.24
Hudson 3.3.0
Sonar-Plugin 2.0.1
Maven 3.0.5 / 3.2.5
JDK 1.7.0_45

On a older hudson version with Sonar-Plugin 1.8.1 the build worked.

As workaround I configured my MAVEN_OPTS path variable to contain the expected settings but since I have to configure different jobs with different settings this is only a workaround.

Anybody got an idea how to fix this issue?


Solution

  • As you can read in Bug 474406 it is a bug of Hudson 3.3.x. It has nothing to do with Sonar Plugin 2.0.1, which worked fine with Hudson 3.1.2.

    It happens with Hudson post build action in:

    A work-around is to add a build parameter to a job, see Bug 474406:

    Build parameter configuration