How can I combine dependencies in subprojects into the root project for Eclipse?

I am trying to define a multi-project build, but be able to run “gradle eclipse” at the top level and have a single set of .classpath and .project files for the entire thing.

The reason I’m considering this is that I want to decompose the project into independent parts (jaxb generation, web service declaration, server implementation). I did this based on one of the examples in the online docs, but then each subproject gets its own .classpath and .project files; I can’t import the entire thing as a single project into Eclipse.

So I think what I need to do is this: 1. apply the ‘eclipse’ plugin only for the root project, not the subprojects 2. in build.gradle for the root project, have it gather all the dependencies for all the subprojects

Any ideas?

Why do you want to import the whole thing as single project? There is no out-of-the-box support for this at the moment, and scripting this will take effort (possibly a lot).

It will all be checked into a single SVN project.

When I develop (this is a large project) I often check out multiple copies of a given project so I can work on different bugs/features concurrently and check them in separately.

This is one of the issues I had with the Gradle IDE plugin for Eclipse; a single eclipse project with multiple Gradle sub projects in it appears as multiple top-level projects in Eclipse. This prevents me from checking out multiple copeis of the project from SVN: the Gradle IDE plugin gives me errors in Eclipse becaues of all the name collisions.

So I’m hoping to do soemthing different. Still have mutiple subprojects in Gradle but import it into Eclipse as a single project with a single .project and .classpath file.

The alternative (and I would appreciate educated opinions on this since I’m new to Gradle) would be to not use subprojects in Gradle at all. Just have everything in a single root project.

The other reason I was considering decomposing it is that we are building a web-services application with JAXB code generation, etc. I’m thinking one subproject that produces a beans.jar generated from JAXB, another one dependent on the first that defines/generates the SOAP services interfaces, and a third (dependent on the other two) where we put our application code that implements all the interfaces.

Am I overthinking this? Should I just keep it as one project? Or should I figure out some way to accomplish what I originally asked, even if I have to manually define dependencies the root build.gradle file?

Whether you decide for a single-project or multi-project Gradle build, stick to the same granularity in Eclipse, as supported by ‘gradle eclipse’ and the Eclipse Gradle tooling. If you go with multi-project and need to work on multiple streams, use different Eclipse workspaces or different branches (perhaps using git-svn bridge), or perhaps look for an Eclipse plugin that provides change lists. A more flexible mapping between Gradle and Eclipse will likely be provided in the future, and I don’t think it’s worth it to implement your own.

I’m revisiting this issue because we are, once again, trying to combine multiple SVN projects into gradle subprojects.

The process doesn’t look that complicated, except that I can’t work out the Gradle scripting to accomplish my desired goal. After calling “gradle eclipse” on the parent project I would like to merge the .classpath files for each of the subprojects as follows: 1. copy all classpathentries with “kind=src” to the parent project, prepending the path with the name of the project 2. copy all classpathentries with “kind=lib” to the parent project, removing duplicates

I’ve done this manually to prove to myself that it works. The challenge now is to do it through Gradle.

Any ideas?