# Generate ScalaIDE Eclipse metadata for Scala projects

**URL:** <https://discuss.gradle.org/t/generate-scalaide-eclipse-metadata-for-scala-projects/434>\
**Category:** Old Forum Archive\
**Created:** [August 31, 2012, 6:30pm UTC](https://discuss.gradle.org/t/generate-scalaide-eclipse-metadata-for-scala-projects/434 "2012-08-31T18:30:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Manes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/benjamin_manes/32/112_2.png) [@Benjamin\_Manes](https://discuss.gradle.org/u/Benjamin_Manes)\
**Post date:** [August 31, 2012, 6:30pm UTC](https://discuss.gradle.org/t/generate-scalaide-eclipse-metadata-for-scala-projects/434/1 "2012-08-31T18:30:00Z")

</div>

The Eclipse plugin generates metadata for Scala projects. When using the ScalaIDE and importing, the build is initially broken with the error: ‘Cannot find Scala library on the classpath. Verify your build path!’ This can be resolved manually by clicking Scala-\>‘Add Scala library to Build Path’. This extra step is automatically handled for Maven users via m2eclipse-scala, as explained in the [ScalaIDE faq](http://scala-ide.org/docs/user/faq.html).

The missing step appears to be that the ScalaIDE expects have its classpath container added to the .classpath file. The import builds successfully if the entry is added manually:

```gradle
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>

```

The question is who is responsible for adding this missing metadata to the Eclipse project? Is it the Scala IDE, Gradle, Gradle STS, or the developer? After discussing this with the Gradle STS team, [STS-2868](https://issuetracker.springsource.com/browse/STS-2868), they suggest that it is probably Gradle’s responsibility due to the Eclipse plugin already adding Scala support to the .project file.

If it is the developer’s, what would be the proper build script update to fix it automatically? I am a little weary of rewriting the raw XML after a previous bad experience due to subtle mistakes. I wrote the following snippet which appears to work,

```gradle
eclipse.classpath.file.withXml { provider ->
  def attributes = [kind: "con", path: "org.scala-ide.sdt.launching.SCALA_CONTAINER"]
  provider.asNode().appendNode("classpathentry", attributes)
}

```

Thanks!

---

<div class="post-metadata">

**Author:** ![Benjamin\_Manes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/benjamin_manes/32/112_2.png) [@Benjamin\_Manes](https://discuss.gradle.org/u/Benjamin_Manes)\
**Post date:** [September 4, 2012, 6:06pm UTC](https://discuss.gradle.org/t/generate-scalaide-eclipse-metadata-for-scala-projects/434/2 "2012-09-04T18:06:00Z")

</div>

The following snippet also works, is shorter, and less of a hack.

```gradle
eclipse.classpath.containers += ["org.scala-ide.sdt.launching.SCALA_CONTAINER"]

```

---

<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:** [September 4, 2012, 7:08pm UTC](https://discuss.gradle.org/t/generate-scalaide-eclipse-metadata-for-scala-projects/434/3 "2012-09-04T19:08:00Z")

</div>

I agree that this should be handled by Gradle’s ‘eclipse’ plugin. Want to send a GitHub pull request?

---

<div class="post-metadata">

**Author:** ![Benjamin\_Manes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/benjamin_manes/32/112_2.png) [@Benjamin\_Manes](https://discuss.gradle.org/u/Benjamin_Manes)\
**Post date:** [September 4, 2012, 9:18pm UTC](https://discuss.gradle.org/t/generate-scalaide-eclipse-metadata-for-scala-projects/434/4 "2012-09-04T21:18:00Z")

</div>

Great, sent [pull request](https://github.com/gradle/gradle/pull/99).
