I'm looking into using Gradle instead of Ant/Ivy. I'm trying to create dependencies between my projects for all configurations, so that for example, project1.compile
depends on project2.compile
, project1.runtime
depends on project2.runtime
, etc.
In Ivy, I did this with the following XML:
project1/ivy.xml
<dependency conf="*->@" org="myorg" name="project2" rev="latest.integration" />
In Gradle, here's what I have tried:
project1/build.gradle
configurations.each { config ->
config.dependencies.add project(path: ':project2', configuration: config.name)
}
But it complains that the project
function doesn't exist:
> Could not find method project() for arguments [{path=:project2, configuration=archives}] on project ':project1'.
Any ideas how to do this?
configurations.all { config ->
project.dependencies.add(config.name,
project.dependencies.project(
path: ':project2', configuration: config.name))
}