使用ZSH安装Groovy(在Jira&Confluence中具有自动化功能)

Full disclosure: I work for Atlassian. As a result, I spend a great deal of time creating, updating, and reading Confluence pages. While Confluence server and cloud both have APIs which can be used to programmatically update/create pages, Adaptavist created an app called ScriptRunner which makes this easier with built-in scripts and pre-written logic. My end-goal is to automate some common, reoccuring tasks either by checking a Jira issue for updates or another confluence page. Most Atlassian applications are written in Java and ScriptRunner uses a flavor of Java called Groovy.

Step 1: install Groovy on OS X

对于自制用户:

brew install groovy

对于MacPorts用户:

sudo port install groovy

Step 2: Set Groovy_home environment variable

欢迎您完全在zsh中执行此操作,但是我手动将其添加到了我的〜/ 。zshrc文件。 另一个注意事项是我已设置Sublime从命令行启动。 如果您喜欢vim,emacs或其他文本编辑器,则需要将引用替换为子级。

subl ~/.zshrc

中〜/ .zshrc,我添加了以下变量导出和注释:

# Add Groovy Home path
export GROOVY_HOME="$(/usr/local/opt/groovy/libexec)"

保存此文件,完成后即可将其关闭。

Step 3: Run a test to check your Groovy install

mkdir groovy-test && cd groovy-test
subl hello.groovy

现在,将测试脚本添加到刚创建的空文件中:

//hello.groovy
println "hello, world"
for (arg in this.args ) {
    println "Argument:" + arg;
}
// this is a comment
/* a block comment, commenting out an alternative to above:
this.args.each{ arg -> println "hello, ${arg}"}
*/

保存此文件,完成后即可将其关闭。

使用以下命令运行它:

groovy hello.groovy MyName yourName HisName

Step 4: Start using Groovy to automate tasks in Jira or Confluence

如前所述,Adaptavist提供了一些内置脚本,但是我发现我的需求更加复杂。 网上有一些很好的例子可以帮助您入门。

from: https://dev.to//preciselyalyss/install-groovy-with-zsh-plus-automation-in-jira--confluence-nji

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值