【发布时间】:2017-08-06 18:16:57
【问题描述】:
我在这里查看此文档:https://docs.gradle.org/3.4.1/dsl/org.gradle.api.tasks.Exec.html,其中提供了如何关闭/打开 tomcat 的示例。
但是,它没有很好地解释 commandLine 期望的确切参数。
所以,下面的代码失败了。您能分享一下想法吗?
task stopTomcat(type:Exec) {
println "$System.env.TOMCAT"
workingDir "${System.env.TOMCAT}" + '/bin/'
//on windows:
commandLine './catalina.sh stop'
//on linux
//commandLine './stop.sh'
//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()
//extension method stopTomcat.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}
我已经按照上面的方式配置了我的任务,但是当我运行任务时它确实失败了。
原因:net.rubygrapefruit.platform.NativeException:不能 开始'./catalina stop'
【问题讨论】:
标签: java tomcat gradle cmd gradlew