嘗試創建屬性文件(foo.properties)並將其添加到戰爭的根目錄。gradle項目構建目錄不存在
apply plugin: 'war'
task createProperties {
FileOutputStream os = new FileOutputStream("${project.buildDir}/foo.properties");
...
}
war {
dependsOn createProperties
from "${project.buildDir}/foo.properties"
...
}
出了什麼問題:
A problem occurred evaluating project ':app'.
> E:\app\build\build.properties (The system cannot find the path specified)
我需要創建build目錄?
對於戰爭,是否有一個輸出目錄爲webapp? (sourceSet:src/main/webapp) 最好直接在webapp outputDir下創建foo.properties
。
$ buildDir和$ {project.buildDir}之間有什麼區別?謝謝。 – eastwater
沒有,你只是不需要限定通話。你可以使用'$ {project.buildDir}',在這種情況下它們確實是相同的。 – Vampire