Hi,
I am running Gradle 2.5 and have a multi-project with project dependencies among the subprojects. One of them performs some integration using a nested Gradle process, which cannot access the artifacts of dependencies, because project dependencies cannot work outside the multi-project, of course.
One solution is to publish all other components first before running the nested Gradle build, but I need to avoid publishing artifacts before all tests are successful.
Therefore I tried the following:
- Define an additional local repository for publishing
- Call just the publish task for this repository for all depending projects.
- Make the nested Gradle build use this local repository.
- Publish all projects to the actual repository afterwards.
I have some problems doing this:
-
PublishToIvyRepositorytasks do not exist by default. It is impossible to run:myproj:someIntegrationTestand have that trigger certain publish tasks, because those tasks are not even created when not actually callingpublishas build task. -
When
publishis mentioned as task when calling Gradle, those tasks will magically be created by some rule, but from the old world it is still not possible to usedependsOnand have that workingtasks.withType(MyIntegrationTask) { integration ->
rootProject.subprojects.findAll { it.name != ‘myproj’ }.each { sub ->
sub.tasks.withType(PublishToIvyRepository)
.matching { it.repository.name == ‘tmp’ }
.all { pub ->
println "$integration.path dependsOn $pub.path"
integration.dependsOn pub
}
}
}
This will println that the dependencies are successfully established, but running gradlew :myproj:someIntegrationTest publish will still execute those publish tasks after the integration test.
How do I do dependsOn properly with publish tasks? Would updating Gradle to 2.7 help here?
