Checking Groovy version Gradle is using

前端 未结 2 1772
别跟我提以往
别跟我提以往 2021-02-13 01:31

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:47

    While trying to check the groovy version during gradle runtime, I found you can also print the Groovy version:

    task version { 
      doLast {
        println "Gradle version: " + project.getGradle().getGradleVersion()
        println "Groovy version: " + GroovySystem.getVersion()
      }
    }
    

    As examples:

    $ ~/usr/gradle-1.8/bin/gradle -q version
    Gradle version: 1.8
    Groovy version: 1.8.6
    
    $ ~/usr/gradle-2.1/bin/gradle -q version
    Gradle version: 2.1
    Groovy version: 2.3.6
    

    Note.- GroovySystem.getVersion() is available since Groovy 1.6.9

提交回复
热议问题