簡體   English   中英

使用 Gradle 調用 powershell 腳本

[英]Calling a powershell script with Gradle

我是 Gradle 的新手,所以請耐心等待。我只是想調用一個 .ps1 文件來執行 gradle。 我將如何設置 build.gradle 文件以在同一目錄中執行 .ps1 文件? 提前致謝!

您可以使用 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM