On 28/02/2011, at 9:23 AM, Kevin Stembridge wrote:

> Hi all,
> 
> I'm trying to convert my multi-project Ant build to Gradle. I have a flat 
> project structure, every subproject is a sibling of the master build project.
> 
> i.e.
> 
> - flight-build (this is the master)
> - flight-common
> - flight-dao
> - flight-service
> 
> When I run a build from the master, it correctly builds the subprojects. When 
> I run a build from a subproject directory, it fails with the following error:
> 
> Cause: Could not find method compile() for arguments 
> [com.mahanaroad:mahana-i18n:1.0] on root project 'flight-common'.
> 
> If I rearrange to a hierarchical build, it works fine.
> 
> My settings.gradle file in the master directory looks like this:
> 
> 
> includeFlat 'flight-common',  'flight-dao', etc. 
> 
> 
> Is there a way to configure a flat multi-project build to allow building of 
> subprojects or is this a missing feature?

Both. Here are some options you have for keeping your structure:

* Put the settings.gradle in the root directory:

rootProject.name = 'flight-build'
rootProject.projectDir = new File(settingsDir, 'flight-build')

include 'flight-common'
include 'flight-dao'

* Put the settings.gradle in a directory called 'master', as a sibling of the 
project directories:

rootProject.name = 'flight-build'
rootProject.projectDir = new File(settingsDir, '../flight-build')

includeFlat 'flight-common'
includeFlat 'flight-dao'

As far as missing feature goes, Gradle should probably look for a 
settings.gradle in any sibling of the current directory, not just in one called 
'master'.


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

Reply via email to