如何指定Gradle包装器下载位置? [英] How can a specify the Gradle wrapper download location?

查看:320
本文介绍了如何指定Gradle包装器下载位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们把我们的项目转移到了Gradle,并且我们持续在Jenkins上构建。我们使用Gradle包装器和Jenkings gradle插件。



我通过查看控制台输出结果确认每次构建都会下载gradle:

  11:24:42正在下载http://services.gradle.org/distributions/gradle-1.5-bin.zip 
11:24:48 .................................................. ......
11:24:49解压缩/home/workspace/our_build/wrapper/dists/gradle-1.5-bin/9si5v6u7tk37kj5dlsrdcm595/gradle-1.5-bin.zip
到/ home / workspace / our_build / wrapper / dists / gradle-1.5-bin / 9si5v6u7tk37kj5dlsrdcm595

我认为原因是因为accurev插件将永远清除每次运行的整个工作区(无法禁用)。



是否可以配置gradle下载位置?
所有工作使用共享位置安全吗?或者每个工作都有一个位置更好?

Wrapper 任务有几个属性允许自定义。您可以指定一个备用URL来下载它( distributionUrl )。您也可以保持原样,但指定包装器必须存储的位置( distributionBase ),这将允许将其存储在每次清理的目录之外您的accurev插件。



我不明白为什么使用共享位置不安全。这是默认情况下完成的,因为包装存储在gradle用户主目录中。


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?

解决方案

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.

这篇关于如何指定Gradle包装器下载位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆