[英]How to add the bash and shell script directory path in gradle build script?
我想在build.gradle腳本中添加包含windows和linux的多個腳本的目錄路徑。 目前我正在定義這樣的任務及其工作正常。
task initdb(type: Exec){
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', 'My_CONF\\pgdb\\initdb.cmd'
} else {
commandLine 'My_CONF/pgdb/initdb.sh'
}
}
但我想把這個任務定義為 -
task initdb(type: Exec){
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', 'initdb.cmd'
} else {
commandLine 'initdb.sh'
}
}
這些腳本還使用My_CONF \\ pgdb目錄中的另一個腳本。
您可以嘗試使用類型為Exec
的任務的workingDir
屬性,該屬性默認為構建腳本根目錄。 在這里查看有關它的文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.