Where should I put gradle.properties in Jenkins

2019-01-26 07:09发布

问题:

Where should I put the gradle.properties file in Jenkins?

I'm using version 1.21 of the Gradle plugin, but it isn't finding the properties file when I put it in the user home .gradle directory.

Any pointers would be much appreciated.

Thanks

UPDATED

The Gradle plugin looks by default in the workspace of each project for a gradle.properties file. In order to use one file across all jobs, you need to set your gradle home in your job configurations as follows, by adding the following under 'switches':

-Dgradle.user.home=$HOME/.gradle

回答1:

The Gradle plugin looks by default in the workspace of each project for a gradle.properties file. In order to use one file across all jobs, you need to set your gradle home in your job configurations as follows, by adding the following under 'switches':

-Dgradle.user.home=$HOME/.gradle


回答2:

In your Jenkins webpage, you can see 'user.home' property in 'System Information' page. (for slve, check slave's 'System Information' page) You'd put gradle.properties under 'user.home'/.gradle/ folder and every gradle job could see that properties. Adding switch is not work if your job runs on the other slave environment (ie. Windows system)



回答3:

In addition to the answer of @devmojopum, make sure "Force GRADLE_USER_HOME to use workspace" is not checked in your job configuration.



回答4:

Just put gradle.properties next to your build.gradle.

Regards, Olle