On 14/11/2011, at 5:28 PM, ecrane wrote:

> I've got a multi-project structure such as the following:
> 
> root 
> +-- subfolder1
> |     +-- projectA  
> +-- subfolder2
>       +-- projectB
> 
> The subfolders are not themselves projects; they just serve to group
> subprojects together. My root/settings.gradle contains:
> 
> include 'subfolder1:projectA', 'subfolder2:projectB'
> 
> In my root/build.gradle, I want to define a task dependency between projectA
> and projectB. Specifically, I want to make projectA's assemble task depend
> on projectB's install task.
> 
> I cannot figure out how to do this. Running the subproject tasks works fine
> if I don't try to modify them, but I cannot figure out how to add anything
> to the sub tasks.
> 
> This does not work:
> 
> project(':subfolder1:projectA'){
>    assemble.dependsOn(':subfolder2:projectB:install')
> }
> 
> It fails claiming the 'assemble' property does not exist. Likewise, trying
> to define the task again in the root project fails because it says the task
> already exists- even if I specify overwrite:true.
> 
> Any ideas? 

Likely because projectB has not yet been evaluated.

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

This should work (but I can't say conclusively without seeing the whole build):

evaluationDependsOn ":subfolder1:projectA"
evaluationDependsOn ":subfolder2:projectB"

project(':subfolder1:projectA'){
   assemble.dependsOn(':subfolder2:projectB:install')
}


Projects are evaluated top down. So what was happening is that projectB had not 
yet been evaluated and therefore did not yet have an install task. 

-- 
Luke Daley
Principal Engineer, Gradleware 
http://gradleware.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to