用Gradle调用Powershell脚本

时间:2018-10-22 14:19:07

标签: powershell gradle

我是Gradle的新手,所以请多多包涵..我只是在尝试调用.ps1文件以使用gradle执行。我将如何设置build.gradle文件以在同一目录中执行.ps1文件?预先感谢!

1 个答案:

答案 0 :(得分:0)

您可以使用gradle Exec

示例:

task execPs(type:Exec) {
   commandLine 'cmd', '/c', 'Powershell  -File  sample.ps1'
}
// add this task to your build.gradle file and execute gradle execPs
// You can use a different name for this task 
// You can add a dependency to include this task as part of your normal build. (like below) 
// build.finalizedBy(execPs)
// with the above command gradle build will call your task at the end of build