# Generate Eclipse projects without specific library dependencies, enabling the Gradle Plugin to manage the dependencies

**URL:** <https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452>\
**Category:** Old Forum Archive\
**Created:** [November 15, 2012, 3:30pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452 "2012-11-15T15:30:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 15, 2012, 3:30pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/1 "2012-11-15T15:30:00Z")

</div>

When I use the Gradle Eclipse Plugin to import gradle projects into Eclipse, it generates classpaths for projects without the individual dependencies. Instead it adds a container dependency to “org.springsource.ide.eclipse.gradle.classpathcontainer”.

How can I generate Eclipse projects with gradle and the eclipse plugin in gradle, that does this, i.e., enables the Gradle plugin in Eclipse to manage dependencies, without generating classpath entries for the individual dependencies? Is there a better way than manually removing those dependencies in the whenMerged hook for example?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 15, 2012, 4:52pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/2 "2012-11-15T16:52:00Z")

</div>

Are you saying that you end up with duplicated dependencies, inside and outside the class path container? I’ve never heard of this problem before.

---

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 15, 2012, 4:58pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/3 "2012-11-15T16:58:00Z")

</div>

Well, yes. At least right after generating the eclipse classpaths from gradle. But maybe I’m not using the plugin correctly. I haven’t found a way to generate eclipse classpaths where gradle dependencies were enabled by default (is there one?). Instead I’m adding the container manually, like this:

```gradle
eclipse {
    project {
     natures
'org.springsource.ide.eclipse.gradle.core.nature', 'org.eclipse.jdt.groovy.core.groovyNature'
  }
      classpath {
    containers 'org.springsource.ide.eclipse.gradle.classpathcontainer', 'org.springsource.ide.eclipse.gradle.dsld.classpathcontainer', 'GROOVY_DSL_SUPPORT', 'GROOVY_SUPPORT'
  }
  }

```

This gives me enabled gradle dependencies in eclipse. I’ve managed to remove the extra dependencies using “minusConfigurations”, but that complicates it a bit, since I need to know the configurations.

Is there a better way?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 15, 2012, 5:04pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/4 "2012-11-15T17:04:00Z")

</div>

When you work with the Eclipse Gradle integration, you don’t generate the class paths yourself. You also don’t have to add the natures and containers.

---

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 15, 2012, 11:06pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/5 "2012-11-15T23:06:00Z")

</div>

You mean that I should use the gradle import wizard instead? I wanted to simplify by generating all necessary config by just running the gradle eclipse task and importing the eclipse projects as usual, but maybe it is better to use the import wizard.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 15, 2012, 11:17pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/6 "2012-11-15T23:17:00Z")

</div>

Yes. Either use ‘gradle eclipse’, _or_ use the STS tooling.

---

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 16, 2012, 12:21pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/7 "2012-11-16T12:21:00Z")

</div>

One reason to generate the eclipse projects was that I want to activate other plugins, findbugs and checkstyle for instance, and generate settings for those. Is that still possible to do automatically while importing with STS tooling?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 16, 2012, 12:27pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/8 "2012-11-16T12:27:00Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 16, 2012, 12:36pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/9 "2012-11-16T12:36:00Z")

</div>

How can I do that? I’d prefer that the user didn’t have to activate those plugins manually.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 16, 2012, 12:42pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/10 "2012-11-16T12:42:00Z")

</div>

As before - configure the Eclipse plugin. Just don’t manually trigger generation of project files.

---

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 16, 2012, 2:41pm UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/11 "2012-11-16T14:41:00Z")

</div>

Ok, two followup questions:

1. The “Import Gradle Project” dialog has an import option “Run before” with “cleanEclipse eclipse” parameters, enabled by default. Is this the correct way to import? Won’t that give the same result as running “gradle eclipse” from command line?

2. In the projects I import the checkstyle plugin doesn’t seem to be activated. Should it be?

---

<div class="post-metadata">

**Author:** ![Szczepan\_Faber](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/szczepan_faber/32/213_2.png) [@Szczepan\_Faber](https://discuss.gradle.org/u/Szczepan_Faber)\
**Post date:** [November 19, 2012, 7:25am UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/12 "2012-11-19T07:25:00Z")

</div>

1. Please refer to the documentation of STS plugin. If it does not answer the question, it’s best if you ask in the STS forums 2. Gradle IDE (eclipse/idea) tasks do not generate the settings for code quality Eclipse plugings. As far as I know, STS does not do it, either. In theory you can hook into IDE metadata generation via whenMerged / withXml API or if necessary create own tasks that generate the checkstyle Eclipse plugin metadata.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [November 19, 2012, 8:35am UTC](https://discuss.gradle.org/t/generate-eclipse-projects-without-specific-library-dependencies-enabling-the-gradle-plugin-to-manage-the-dependencies/7452/13 "2012-11-19T08:35:00Z")

</div>

That helps! Thank you both for your answers.
