1
我使用等級v3.4。我提出以下屬性到一個文件名爲local.properties(同一目錄中的build.gradle):設置屬性讀取從local.properties裏面build.gradle
local.properties
nexusUsername=someuser
nexusPassword=somepassword
的build.gradle
File secretPropsFile = file('./local.properties')
if (secretPropsFile.exists()) {
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
project.set name, value
}
} else {
throw new IllegalStateException("secret.properties could not be located for build process")
}
我收到以下例外情況:
Could not find method set() for arguments [nexusUsername, someuser] on root project 'some-java-project of type org.gradle.api.Project.