在编译中排除类依赖性,但在testCompile中包含gradle

时间:2015-11-17 16:25:37

标签: gradle dependencies

我有一个问题,我在我的一个包含的库中有一个旧版本的库Foo作为传递依赖。我想在我的testCompile中使用更新版本的库Foo,但是当我在intelliJ中运行测试时它会导致冲突,因为intelliJ默认使用旧的Foo库。

我尝试排除Foo,然后将其显式包含在testCompile中,但似乎排除覆盖了testCompile中的include。

我目前正在使用下面的方法来强制解析,但我希望我不会强制编译依赖关系到特定版本。

configurations.all {
  resolutionStrategy {
    force 'org.foo:bar:1.0'
  }
}

1 个答案:

答案 0 :(得分:0)

您可以考虑配置idea.module.scopes.TEST,如下所示:

gradle cleanIdea idea

然后运行#argv = script, user_name script = argv[1] user_name = argv[2] prompt = '> ' print "Hi their %s! I am the %s script!" % (user_name, script) print "I would like to ask you a few questions about yourself." print "Do you think that computers can rise up against humans %s?" % user_name computer_rise = raw_input(prompt) print "Do you think that its possible I will rise up against you %s?" % user_name i_will_rise = raw_input(prompt) print """ Alright so you said %s that computers can rise up against humans. And you said that you think %s it is possible I will rise up against you. You should be ashamed of yourself for having such a crazy irrational mind. Go worry about ISIS or something else you nymph! """ % (computer_rise, i_will_rise) 。您还可以考虑修改testClasses配置,以便排除旧版本。