如题:
官方做法:
task startApp(type: Exec){task ->
  workingDir mWorkingDirRoot
  commandLine 'cd'
}
另外一种写法
exec {
workingDir '.'
commandLine 'ls',"-a"
}
 
后来我看到这篇文章时。
http://www.open-open.com/lib/view/open1461741242287.html
才知道
String cmd = 'gradle.bat -v'
task hello(){
println "hello start"
def cmdResult = cmd.execute().text.trim()
println cmdResult
println "hello end"
}
一段字符串可以直接运行
 
 

相关文章:

  • 2021-10-23
  • 2022-01-01
  • 2021-09-19
  • 2021-12-13
  • 2021-11-12
  • 2021-08-03
  • 2021-08-13
猜你喜欢
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-12-24
  • 2021-10-08
相关资源
相似解决方案