[GRADLE-1414] Can't import base project and subprojects into Eclipse Created: 02/Mar/11  Updated: 04/Jan/13  Resolved: 04/Mar/11

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-1
Fix Version/s: 1.0-milestone-1

Type: Bug
Reporter: Ben McCann Assignee: Peter Niederwieser
Resolution: Won't Fix Votes: 1


If I apply the Eclipse plugin on my base project, I'm then unable to import my subprojects (File->Import->Existing Projects into Workspace). If I only apply the Eclipse plugin to my subprojects, and leave it off my base project, it will then import all the subprojects. However, I'm then unable to edit the files in my base project within Eclipse.

Comment by Peter Niederwieser [ 03/Mar/11 ]

As far as I know, this is just the way Eclipse ticks. I remember Eclipse users insisting on a flat directory layout, i.e. not putting any files in the parent directory but in a sibling of the subproject directories. Gradle supports flat directory layout out-of-the-box. Search for "includeFlat" in the single-page user guide (http://gradle.org/latest/docs/userguide/userguide_single.html).

Comment by Ben McCann [ 04/Mar/11 ]

You can do it in m2eclipse, but it appears to be functionality in their Eclipse plugin which isn't supported in Eclipse by default, and so it wouldn't be possible to do with 'gradle eclipse'. Anyway, the includeFlat solution is just as good if not better.

Comment by Scott Geertgens [ 20/Jun/11 ]

I'm not sure the 'right' way to go about it, but if possible it would be great to see 'includeFlat' emphasized more in the documentation. Eclipse's choice to go with a flat directory layout is quite annoying when attempting to integrate a convention-based build system with it (since most conventions assume a sane layout). The fact that gradle supports this with just a single line is a huge feature, and very easily overlooked as it isn't mentioned in the Multi-Project chapter.

Suggestions: Add at least a back-reference to includeFlat in Chapter 35 from somewhere in Chapter 36, and add an example of why you'd ever use includeFlat to begin with (specifying that it would be commonly used for eclipse-style layouts would really help in random google searching).

Comment by Adam Murdoch [ 21/Jun/11 ]

Eclipse does handle this setup. It's only the import wizard which does not. You can work around this by pointing the import wizard at the root project, and then at each of the subprojects. Awkward, but it does work.

Alternatively, you might try the STS Gradle plugin, which can import any type of multi-project layout easily.

Generated at Wed Jun 30 11:54:56 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.