【发布时间】:2017-03-03 03:15:28
【问题描述】:
我目前正在使用 gmaven plus 在 maven 中运行一个 groovy 命令。
命令(为了举例)将是
git help
如果我在 linux 上运行它,我可以这样做:
'git help'.execute().text.trim()
但这在 Windows 上不起作用。相反,我需要这样做:
'cmd /C git help'.execute().text.trim()
是否有跨平台的方式来做到这一点?
【问题讨论】:
-
我可以在 Windows 上的 Groovy shell 中执行
'git help'.execute().text.trim()。如果它使用普通的 Groovy shell 在 Maven 之外工作,也许可以尝试一下。 -
我做到了,我下载并运行了 groovysh 并遇到了这个问题。当我从 git bash 或从 cygwin 但不是从普通命令提示符(没有尝试 power shell)运行它时,它工作正常。问题是团队中的大多数人都在 linux 或 mac OS 上工作,少数人在 vanila 命令提示符下运行,所以我需要它在这两种环境下工作
标签: groovy gmaven-plugin