On 23/05/2011, at 10:48 PM, Jan Ahrens wrote:
> Hi,
>
> I'm trying to setup a multi-project build, that includes a subproject,
> which has it's own build.gradle, and itself a couple of dependencies.
>
> The problem is that the subproject, that I'm trying to include, has also
> sub-projects and dependencies between those sub-projects.
>
> The dependencies are prefixed with a 'colon', and treated by gradle as
> if they were directly located as children of the main project, which
> they are not.
>
> The subproject, that I'm trying to include is the 'Spock Framework' [0]
> and the project layout is like this:
>
> /
> build.gradle
> settings.gradle
> spock/
> build.gradle
> settings.gradle
> spock-core/
> build.gradle
> settings.gradle
> spock-specs/
> build.gradle
> settings.gradle
>
> Contents of '/settings.gradle':
> --- BEGIN ---
> include 'spock'
> include 'spock:spock-core'
> include 'spock:spock-specs'
> --- END ---
>
> The reason why I'm including 'spock:spock-core' in '/settings.gradle' is
> that I'm needing that dependency for the root project.
>
> The dependency configuration in '/spock/spock-specs/build.gradle':
> --- BEGIN ---
> dependencies {
> testCompile project(':spock-core') // line 6
> // ...
> }
> --- END ---
>
> When trying to build the root project, I'm getting the following error
> message.
> --- BEGIN ---
> * Where:
> Build file '/spock/spock-specs/build.gradle' line: 6
>
> * What went wrong:
> A problem occurred evaluating project ':spock:spock-specs'.
> Cause: Project with path ':spock-core' could not be found in project
> ':spock:spock-specs'.
> --- END ----
>
> My question is: How am I supposed to include the sub-project 'spock' in
> a way that gradle knows that the colon in the 'spock' folder means
> another 'root'.
There's no support for this in Gradle, yet. There can only be 1 root project
and 1 settings.gradle in a multi-project build.
This is something we want to improve in the future, so you can include a
multi-project build in another build, without needing to change it.
> Is there a notation for relative project-paths?
Only for referring to sub-projects, but not siblings. If a path does not start
with a ':', it is treated as a path relative to the referring project.
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com