Best practice for parallel project layout

(b228000) #1

I have not found something useful in the forums so i will post my question here.

What does a file look like for a parallel project structure like this. I can’t get it working so far. I want my project structure to look like this:

org.sample.project (contains and gradle.settings) org.sample.project.core org.sample.project.client org.sample.project.server … I dont want a project sourrounding these projects.

I tried a multi project build. In the gradle settings i was able to define ‘project.core’ ‘project.client’ and ‘project.server’ as subprojects of ‘project’

However i get into trouble when i want the client project to be a gwt project and maybe have more client projects as gwt-modules.

How does the gradle support for is this parallel project layout look like? Is it a better idea to have multiple gradle build files which are called from the main file from the ‘org.sample.project’ dir?

Thanks for any help :slight_smile:

(Gary Hale) #2

You can automatically add subprojects to a project included in a hierarchical layout, but you can’t automatically add subprojects to a project included in a flat layout. If you really need such a layout, you can manually configure the subprojects in settings.gradle. For instance, given a layout like:

. ├── child1 │ ├── grandchild1 │ └── grandchild2 ├── child2 ├── child3 └── root

Where “root” is the root project, root/settings.gradle would set up grandchild1 and grandchild2 as such:

includeFlat 'child1', 'child2', 'child3'
  [ 'grandchild1', 'grandchild2' ].each { dir ->
    include ":child1:${dir}"
    project(":child1:${dir}").projectDir = new File(project(':child1').projectDir, "${dir}")

(b228000) #3

Ok nice that helped a bit. But still i have problems with GWT.

org.sample.project.client is a gwt application which references via inherit module the org.sample.project.core project.

The Gradle-GWT Plugin (steffenschaefer) complains about not having Core.gwt.xml on the classpath.

Any ideas on this would be great. Anyway thanks for that hint Gary.