How do you set/pass project.ext.XXX variable to task/plugin?

buildship
eclipse
plugins

(Eric To) #1

I have the following in my build.gradle script:

project.ext.password = ''

gradle.taskGraph.whenReady { taskGraph ->
  if(taskGraph.hasTask(':signJars')) {
    project.ext.password = 'test'
  }
}

jnlp {
    useVersions = true
    usePack200 = false
    mainClassName = 'main.Program'
    withXml {
        information {
            title 'Blah'
            vendor 'Blah'
        }
        security {
            'all-permissions'()
        }
    }    
    println(project.ext.password)
    signJarParams = [keystore: 'jks/local.jks', alias: 'test', storepass: project.ext.password]
}

What is the correct way to set and/or pass the variable to other plugin task?

I also tried '${project.ext.password}' as well as other ways, ex: ${ext.password}, project.ext.password, etc.