Global MAVEN_OPTS does not seem to work with Jenkins
jenkins, maven
Solution
AFAIU, it is a Jenkins normal behavior to put the `MAVEN_OPTS` after the `java command`. Since the purpose of the `MAVEN_OPTS` is the environment variable in the user variables to specify JVM properties.
I would suggest you to put the `-X` parameter at the `Jenkins Maven Job` itself. At the `Build ---> Goals and options`, you may click the `question mark link` at the end of the textbox. It will give you the following: -
Specifies the goals to execute, such as "clean install" or "deploy". This field can also accept any other command line options to Maven, such as "-e" or "-Dmaven.test.skip=true".
Then the suitable value for `Build ---> Goals and options` should be something like `clean install -X`.
I hope this may help.
Problem
I installed Jenkins 1.512 on CentOS (info as follows) and configured it to work with apache-maven-3.0.4. ``` Linux server.masstermmind.com 2.6.32-358.2.1.el6.x86_64 #1 SMP Tue Mar 12 14:18:09 CDT 2013 x86_64 x86_64 x86_64 GNU/Linux ``` I was actually trying to solve a problem where Maven complained about missing vaule of `jbossHome` parameter in the `pom.xml` file. So, I decided to debug Maven by putting the `-X` option in Jenkins `MAVEN_OPTS`. But it complained that I put in an incorrect Java argument: ``` The -X options are non-standard and subject to change without notice. ``` It turned out Jenkins thinks I put in an argument for Java. Later I found out the command generated by Jenkins was like the following: /usr/java/jdk1.7.0_17/bin/java -X -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/usr/share/apache-maven-3.0.5/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/apache-maven-3.0.5 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.23.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 35460 But what I found out from running `mvn`, it generated the following Java line, and the "-X" was placed at the end, correctly. /usr/java/jdk1.7.0_17/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/usr/share/apache-maven-3.0.5/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/apache-maven-3.0.5 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.23.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar -X Could you share an approach how I can fix this or it is a Jenkins bug?