On 13/01/2011, at 3:39 AM, richardm wrote:

> 
> Hi, I have a multi-project build and I'm trying to add a task to create a zip
> of files generated in sub-projects.  Here's a sample of what I'm trying to
> do.  I'm seeing some unexpected results and think I either have my projects
> setup incorrectly or have a dependency problem.  
> 
> allprojects {
>    apply plugin: 'java' 
> }
> 
> project(':projA') {
>       apply plugin: 'war'
>       war {
>               from "$projectDir/lib"
>       }
>       
>       task war2(type: War, dependsOn: classes) {
>               baseName = "war2"
>               from "$projectDir/lib"
>       }
>                       
>       //artifacts { archives war, war2 }    
>       assemble.dependsOn war, war2
> }
> 
> configurations {
>    distLibs
> }
> 
> dependencies {
>    distLibs project(':projA'), project(':projB')
> }
> 
> task distTest(dependsOn: configurations.distLibs) {}
> 
> Running gradle projA:build runs as expected.  
> 
> D:\tmp\gradle-test2>gradle projA:build
> :projA:compileJava UP-TO-DATE
> :projA:processResources UP-TO-DATE
> :projA:classes UP-TO-DATE
> :projA:jar SKIPPED
> :projA:war UP-TO-DATE
> :projA:war2 UP-TO-DATE
> :projA:assemble UP-TO-DATE
> :projA:compileTestJava
> :projA:processTestResources
> :projA:testClasses
> :projA:test
> :projA:check
> :projA:build
> 
> In projA I have set a dependancy on the assemble task to war and war2,
> however If I run my distTest task it only executes the first war task. 
> Running distTest doesn't seem to run the assemble task on projA.
> 
> D:\tmp\gradle-test2>gradle distTest
> :projA:compileJava UP-TO-DATE
> :projA:processResources UP-TO-DATE
> :projA:classes UP-TO-DATE
> :projA:war UP-TO-DATE
> :projB:compileJava UP-TO-DATE
> :projB:processResources UP-TO-DATE
> :projB:classes UP-TO-DATE
> :projB:jar UP-TO-DATE
> :distTest UP-TO-DATE
> 
> I can get war2 to execute if I replace assemble.dependsOn war, war2 with
> artifacts { archives war, war2 }    however this is still missing out the
> other assemble tasks.  Am I doing something wrong?

When you add a project dependency, Gradle adds the task dependencies needed to 
build the archives in the 'archives' configuration of the target project. It 
adds only enough to build the archives - namely the jar/war tasks. It doesn't 
add the 'assemble' task.

So, by default, it will only run the 'war' task, as this is the only archive in 
the 'archives' configuration.

When you add war2 to the 'archives' configuration, it starts run both 'war' and 
'war2'

Before Gradle 1.0, we plan to rework the dependency DSL a bit. One potential 
change will be to add an implicit 'assemble' task for each published 
configuration. When you add a project dependency, Gradle will add a task 
dependency on the assemble task for the target configuration. When you add an 
artifact to a configuration, Gradle will add a dependency from the assemble 
task to the task that builds the configuration. This will allow  you a lot of 
flexibility around what happens when a project dependency is used.


> 
> -- running gradle projA:build with //artifacts { archives war, war2 } 
> D:\tmp\gradle-test2>gradle distTest
> :projA:compileJava UP-TO-DATE
> :projA:processResources UP-TO-DATE
> :projA:classes UP-TO-DATE
> :projA:war UP-TO-DATE
> :projA:war2
> :projB:compileJava UP-TO-DATE
> :projB:processResources UP-TO-DATE
> :projB:classes UP-TO-DATE
> :projB:jar UP-TO-DATE
> :distTest
> 
> 
> 
> -- 
> View this message in context: 
> http://gradle.1045684.n5.nabble.com/create-distribution-using-multi-project-build-problem-getting-assemble-to-run-on-subprojects-tp3338459p3338459.html
> Sent from the gradle-user mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to