Checking Groovy version Gradle is using

前端 未结 2 1067
慢半拍i
慢半拍i 2021-02-13 01:18

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).

$ g         


        
2条回答
  •  悲哀的现实
    2021-02-13 01:44

    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.

    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"
    }
    

提交回复
热议问题