用Gradle调用Powershell脚本 [英] Calling a powershell script with Gradle

查看:125
本文介绍了用Gradle调用Powershell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to Gradle, so bear with me.. I am simply trying to call a .ps1 file to execute with gradle. How would I go about setting up a build.gradle file to execute the .ps1 file within the same directory? Thanks in advance!

推荐答案

您可以使用gradle

You can use 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

这篇关于用Gradle调用Powershell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆