简体   繁体   中英

Where should I put gradle.properties in 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

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

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)

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

摇篮配置

I do not agree with the upvoted answers. This only works in single-workspace environments. If you use multiple projects, have multiple nexus environments to publish to,and want also eg jenkins not to mess up, then you should read

https://docs.gradle.org/current/userguide/build_environment.html

how to chain gradle properties.

Gradle project properties can be stored in a separate folder and copied to the workplace root, the latter one added to .gitignore, so everybody can configure her own passwords and settings.

This also encourages to use the FORCE flag to be uses in Jenkins.

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

Regards, Olle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM