跳过刷新gradle中的依赖关系 [英] Skip refreshing dependencies in gradle

查看:221
本文介绍了跳过刷新gradle中的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题的简短版本:
有没有告诉gradle不要解决依赖关系的方法?我知道我可以使用-x开关跳过单个任务,但是解决依赖问题并不会执行,但我不知道该怎么做。 长版本:
现在我可以使用简单的'gradle test'从Gradle运行测试,它执行收集依赖项,构建和运行测试。
但是我也想在其他一些无法从Maven下载依赖的机器上使用gradle运行测试。我认为我可以执行一些打包,将所有依赖关系下载到某个lib文件夹,并且可以将测试类路径(在该任务中)展开到该文件夹​​。问题是,当我运行'gradle myTests'时,gradle仍然尝试联系maven。有没有办法来解决这个单一任务的依赖关系?

解决方案

- offline 标志。或者,只要构建应该以本地依赖关系运行,就可以声明 flatDir 而不是 maven 存储库。

Short version of question: Is there a way of telling gradle not to resolve dependencies? I know I can skip single task with -x switch but resolving dependencies isn't performed though some task I guess, to I don't know how to do it.

Long version: Right now I can run tests from gradle with simple 'gradle test' which performs gathering dependencies, building and running tests.. But I'd also like to run tests using gradle on some other machine which can't download dependencies from maven. I thought that I could just perform some packaging which would download all dependencies to some lib folder, and I could expand tests classpath (in that task) to this folder. The problem is, that gradle still tries to contact maven when I run 'gradle myTests'. Is there a way of preventing resolving dependencies for this single task?

解决方案

There's the --offline flag. Alternatively, you can declare a flatDir rather than a maven repository whenever the build should be run with "local" dependencies.

这篇关于跳过刷新gradle中的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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