Accessing external properties from a plugin


We have a multi-project build that loads a gradle file using “apply”.

I need to be able, in that plugin, to access a property set in a separate build.gradle.

The layout and contents of a simple example:

…build.gradle <---- set it here
…foo.gradle <---- use it here

include ‘:dir4’

apply from : ‘…/dir2/foo.gradle’

task DOIT << {
println “Just Did it!”

println ":dir4:DIR4_EXTVAR = " + DIR4_EXTVAR

println "DIR3: EXTVAR = " + project(’:dir4’).get(‘EXTVAR’)

I am sure that this is either order of elaboration or configtime vs runtime. Good examples to study will be fine…I understand that this is too basic for words!

All apologies to anyone who actually read that thing.

The value that I am trying to pass is also the output of a task and so I ought
to be able to define proper output there (it is a Copy task) and use that to get
the value I need.

I am just not finding a lot of basic stuff on gradle…the big things I can work on…