Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a JVM option in Jenkins globally for every job?

I've recently installed a new JDK (1.7u9), and I got some very strange VerifyErrors. In a thread I found that it could help me if I use a -XX:-UseSplitVerifier magic switch for the compilation.

What I would like to do is to set this Java option globally in Jenkins, but haven't found any configurations for it. Can someone help me out how can I do this?

The closest thing I was able to come up with is to set the argument through Maven, but I have to do it for each project configuration - and I'd like to avoid that.

Thanks in advance.

like image 498
rlegendi Avatar asked Oct 17 '12 08:10

rlegendi


2 Answers

Under the main menu item Manage Jenkins->Configure System you can set it in the box for Global MAVEN_OPTS.

It is a bit unclear whether you want the option turned on for the Jenkins container itself or only the jobs running in it, but if the latter and you're only running maven jobs, that's what I would do.

Cheers,

like image 69
Anders R. Bystrup Avatar answered Sep 22 '22 18:09

Anders R. Bystrup


If you deploy the Jenkins to the Tomcat or Glassfish, I would like to suggest you to set further configuration as the following:-

The Tomcat

Set the environment variable named CATALINA_OPTS, e.g.

SET CATALINA_OPTS="-XX:-UseSplitVerifier"
EXPORT CATALINA_OPTS

The Glassfish

Edit the [your_domain]/config/domain.xml

<java-config ....>
    ....
    <jvm-options>-XX:-UseSplitVerifier</jvm-options>
</java-config>

Anyhow if you deploy it to another application server, please refer to your application server administrator guide to configure further JVM options.

UPDATED:

If you only would like to apply this JVM option to the Maven project, please set the environment variable named MAVEN_OPTS, e.g.

SET MAVEN_OPTS="-XX:-UseSplitVerifier"
export MAVEN_OPTS

I hope this may help.

Regards,

Charlee Ch.

like image 44
Charlee Chitsuk Avatar answered Sep 20 '22 18:09

Charlee Chitsuk