Groovy 在很多地方有使用,如 Jenkins 和 Nexus Repository。
一、下载版本
https://groovy.jfrog.io/ui/native/dist-release-local/groovy-zips/
https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-sdk-4.0.17.zip
https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-binary-4.0.17.zip
https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-docs-4.0.17.zip
https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-src-4.0.17.zip
SDK bundle 版本,包含了(binary 、source、document)。这里下载SDK版本用于测试。
对比项 | binary | document | source | sdk bundle |
---|---|---|---|---|
压缩包 | 31.1MB | 22.1MB | 9.03MB | 62.4MB |
解压后 | 34.7MB | 179MB | 27.1MB | 241MB |
SDK目录结构如下:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2024/1/11 11:14 bin
d----- 2024/1/11 11:14 conf
d----- 2024/1/11 11:15 doc // document
d----- 2024/1/11 11:14 grooid
d----- 2024/1/11 11:14 lib
d----- 2024/1/11 11:14 licenses
d----- 2024/1/11 11:16 src // soucecode
-a---- 2024/1/11 11:14 14330 LICENSE
-a---- 2024/1/11 11:14 1478 NOTICE
二、部署
1. windows
将解压的文件夹 groovy-4.0.17
放到 C:\Program Files\groovy-4.0.17\
设置环境变量 GROOVY_HOME
,指向 C:\Program Files\groovy-4.0.17\
设置 PATH ,增加 %GROOVY_HOME%\bin
根据各自情况设置 JAVA_HOME
。
Groovy 4.0 is the latest stable version of Groovy designed for JDK8+ with much improved JPMS support.
C:\Users\robin>groovysh.bat
Groovy Shell (4.0.17, JVM: 1.8.0_202)
Type ':help' or ':h' for help.
-------------------------------------------------------------------------------
groovy:000>
groovy:000> assert 'ab' == 'a' + 'b'
===> null
groovy:000> assert 'bcd' =='b' + 'd'
ERROR org.codehaus.groovy.runtime.powerassert.PowerAssertionError:
assert 'bcd' =='b' + 'd'
| |
false 'bd'
调试命令
groovysh
orgroovysh.bat
:打开 shell
groovyConsole
orgroovyConsole.bat
:打开交互式窗口
groovy SomeScript
orgroovy.bat SomeScript
:执行脚本
![](https://img.haomeiwen.com/i18908711/10dbe686293edbbd.png)
网友评论