myPlugin is creating an extension
project.extensions.create("myPlugin", MyPluginExtension)
build.gradle
project.ext {
env = "development"
}
// set value to the evn in extension
myPlugin {
env = project.env
}
task myTask<< {
configurations.each { config ->
println "env1 = " + project.env
}
}
println "env2 = " + project.env
The command I’m running
gradle -Penv="testing"
The result is bellowing, but I’m expecting both should output “testing”
env2 = development
env1 = testing