gradle 处理 properties file
读取多个properties file,合并后写入到一个properties file里。
task mergeProp << {
def props = new Properties()
['file1.properties','file2.properties'].each {
props.load(new FileReader(file(it)))
}
def writer = new FileWriter(file('merged.properties'))
try {
props.store(writer, 'Some comment')
writer.flush()
} finally {
writer.close()
}
}
参考:https://discuss.gradle.org/t/read-write-properties-file-in-my-case/5897/2