You can declare a configuration time dependency using evaluationDependsOn(':projB')

http://gradle.org/0.7/docs/userguide/multi_project_builds.html#sub:configuration_time_dependencies

John Murph wrote:
Consider a multi-project build with the following setup:

projA/build.gradle and projB/build.gradle both contain this

task a << { }

Executing "gradle :projA:a" gives

:projA:a

BUILD SUCCESSFUL

So far, so good. ProjA's a task does not depend on ProjB's a task, which is what I want. Now, I need projB to reference a property defined in projA

projA/build.gradle is now

println project(':projB').prop
task a << { }

and projB/build.gradle is now

prop = 'projB set this prop'
task a << { }

Executing "gradle :projA:a" now gives

A problem occurred evaluating project ':projA'.
Cause: Could not find property 'prop' on project ':projB'.

BUILD FAILED

This is because projA is executed before projB. Ok, to resolve this, I add a "dependsOn ':projB'" to the top of projA. Now, executing "gradle :projA:a" gives

projB set this prop
:projB:a
:projA:a

BUILD SUCCESSFUL

So, I now can access the property I wanted, but a task dependency was suddenly added from projA:a to projB:a. That's not what I wanted. How can I get access to projB's project properties without all these task dependencies being added?

--
John Murph
Automated Logic Research Team

Reply via email to