Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I put gradle.properties in Jenkins

Tags:

gradle

jenkins

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
like image 851
user1740752 Avatar asked Apr 23 '13 12:04

user1740752


People also ask

Where do we configure maven Gradle in Jenkins?

Gradle configuration is performed in the Configure System (before Jenkins 2.0) or Global Tool Configuration (starting in Jenkins 2.0). In both cases these options reside in the Manage Jenkins section.


3 Answers

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
like image 86
user1740752 Avatar answered Oct 21 '22 06:10

user1740752


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)

like image 34
devmojopum Avatar answered Oct 21 '22 06:10

devmojopum


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

Gradle Configuration

like image 45
user2880229 Avatar answered Oct 21 '22 05:10

user2880229