我有以下代码片段:
def getVersion = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
每当我调用getVersion()
时,就会出现以下错误:
* What went wrong:
A problem occurred evaluating root project 'ForgeWorkspace'.
> Process 'command 'git'' finished with non-zero exit value 128
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.442 secs
在我的MacBook Pro上,我从未遇到过这个问题,但在Windows上却遇到了。非常感谢您的帮助!