Search code examples
gradlegradle-eclipse

Eclipse plugin for Gradle - group libraries? (annoyance)


I've been digging into Gradle and loving it so far! I was delighted to find that apply plugin: 'eclipse' would easily generate an Eclipse project, but I'm irked by the fact that the dependency libraries show up under the root of the project in the Project Explorer view, like so:

Eclipse Project Explorer with generated project from Gradle

That seems unsustainable as the list of libraries expands. Yeah, it doesn't affect the functionality, but it's sure ugly. I'd rather group them into a Libraries "folder" or something like that. Does anyone know of an easy way? I'm thinking I can use withXml to monkey with the project definition, but it seems like someone else has probably thought of this and there must be a better way.

Bonus if I can easily see the subset of libraries that get packaged in (vs e.g. testCompile or providedCompile) when using the war plugin!


Solution

  • If you use Gradle Plugin for Eclipse developed by Pivotal folks there is an option to use classpath container that does what you want - it replaces individual classpath entries with one (expandable).

    To enable this feature Right click on the project and select 'Gradle >> Enable Dependency Management'