检查Gradle使用的Groovy版本 [英] Checking Groovy version Gradle is using

查看:508
本文介绍了检查Gradle使用的Groovy版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行gradle,以前一直在运行groovy 1.76.现在,我已在本地计算机上更新为groovy(groovy_home指向groovy 2.1.2等).

I am running gradle and have previously been running groovy 1.76. I have now updated to groovy on my local machine (groovy_home points to groovy 2.1.2 etc).

$ groovy -version
Groovy Version: 2.1.2 JVM: 1.7.0_17 Vendor: Oracle Corporation OS: Linux

但是,当我运行gradle命令(等级测试,类等)时,我相信它不是针对groovy 2.1.2构建的,而是实际上仍针对1.76构建的. (我之所以这样认为,是因为当我执行类时,我不断收到此错误升级Groovy 1.7-2.1不兼容,这与1.76之后所做的更改有关)

However, when I am running gradle commands (gradle test, classes, etc) I believe it is not building against groovy 2.1.2 but is actually still building against 1.76. (The reason I believe this, is that when I execute the classes I keep getting this error Upgrading Groovy 1.7 - 2.1 Incompatability, which is related to changes made post 1.76)

有没有办法确认我的gradle安装所针对的是groovy的哪个版本?

Is there a way to confirm which version of groovy my gradle install is building against?

还可以有人确认我应该在哪里为Gradle配置groovy版本吗?

Also, can anyone confirm where I should be configuring the groovy version for gradle?

推荐答案

要针对哪个Groovy库(以及正在使用哪个Groovy编译器)确定驻留在compile上的Groovy库(或更早版本) Gradle版本,groovy)配置.通常,Groovy依赖关系是显式配置的,但也可以通过传递依赖关系管理将其引入. (在版本冲突的情况下,默认情况下将赢得较高版本.与您的计算机上安装的Groovy版本无关).gradle dependencyInsight --configuration compile --dependency groovy应该提供答案.

Which Groovy library you are building against (and which Groovy compiler you are using) is determined by which Groovy library resides on the compile (or, in earlier Gradle versions, groovy) configuration. Typically a Groovy dependency is configured explicitly, but it may also be pulled in by transitive dependency management. (In case of a version conflict, the higher version wins by default. Which Groovy version(s) you have installed on your machine is irrelevant.) gradle dependencyInsight --configuration compile --dependency groovy should provide the answer.

以下是通常配置Groovy依赖项的方式:

Here is how a Groovy dependency is typically configured:

apply plugin: "groovy"

repositories {
    mavenCentral() // or some other repository containing a Groovy library
}

dependencies {
    // in Gradle 1.4 or earlier, replace 'compile' with 'groovy'
    compile "org.codehaus.groovy:groovy-all:2.1.2"
}

这篇关于检查Gradle使用的Groovy版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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