How can a specify the Gradle wrapper download location?

别等时光非礼了梦想. 提交于 2020-01-04 01:49:31

问题


We moved our project to gradle and we have continuous build on Jenkins. We use the gradle wrapper and the Jenkings gradle plugin.

I recognized by reviewing the console output that gradle will be downloaded on each build:

    11:24:42 Downloading http://services.gradle.org/distributions/gradle-1.5-bin.zip
    11:24:48 ........................................................
    11:24:49 Unzipping /home/workspace/our_build/wrapper/dists/gradle-1.5-bin/9si5v6u7tk37kj5dlsrdcm595/gradle-1.5-bin.zip 
          to /home/workspace/our_build/wrapper/dists/gradle-1.5-bin/9si5v6u7tk37kj5dlsrdcm595

I think the reason is because the accurev plugin will purge always the whole workspace for each run (cannot be disabled).

Is it possible to configure the gradle download location? Is it safe to use a shared location for all jobs? Or is it better to have a location per job?


回答1:


The Wrapper task has several properties allowing its customization. You can specify an alternate URL to download it (distributionUrl). You can also leave the URL as is, but specify where the wrapper must be stored (distributionBase), which would allows storing it outside of the directory which is cleaned up every time by your accurev plugin.

I don't see why it wouldn't be safe to use a shared location. This is what is done by default, since the wrapper is stored in the gradle user home directory.



来源:https://stackoverflow.com/questions/16102319/how-can-a-specify-the-gradle-wrapper-download-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!