Eclipse Gradle multiprojects

时间:2015-05-12 22:58:13

标签: eclipse gradle multi-project

I've just been through the ringer trying to get this to work so I thought i would share my experience.

The problem (so I can answer it QA style):

I have a flat project structure where the sub-projects are siblings of the root project:

.parents(".box").first()

In my rootProject childProject1 childProject2 childProject3 I used an rootProject:settings.gradle:

include

This worked for the simple builds (no real gradle configuration had yet been performed).

Then upon include '../childProject1', '../childProject2', '../childProject3' the import dialog showed:

Gradle Import > Build Model

And there were no childProjects.

I did a bit of reading and had the Aha! moment when i re-read the doco and saw I actually want [] rootProject . So I changed it to:

includeFlat

However it didn't work. Grumble grumble grumble.

What could I do to fix this?

1 个答案:

答案 0 :(得分:0)

After a bit of playing around I had to do:

  1. Delete these files from the project's:

    • includeFlat 'childProject1', 'childProject2', 'childProject3'
    • .project
    • .settings
  2. Sometimes that wasn't enough and I had to shut down Eclipse / STS and delete the contents of the workspace directory

Then it worked and upon .gradle of the RootProject I would see in the import dialog:

build Model

Problem solved.

I've never encountered a situation like this where I had to do lots of eclipse project metadata cleanup to get functionality functioning.