We're using gradle as well and had to tweak the generated .classpath
slightly to make it work with scala-ide:
- Since gradle has scala-library as dependency, it's put on the
"Referenced Libraries", which for some reason causes scala-ide to
always build the entire project
- In order to run specs2 unit tests with the JUnitRunner, the
SCALA_CONTAINER should come before the JRE_CONTAINER in order for
scala-ide to find the test classes
eclipse {
classpath {
containers "org.scala-ide.sdt.launching.SCALA_CONTAINER"
file {
whenMerged { classpath ->
def javaRuntime = classpath.entries.find { it instanceof
org.gradle.plugins.ide.eclipse.model.Container &&
it.path.contains('JRE_CONTAINER') }
def scalaRuntime = classpath.entries.find { it instanceof
org.gradle.plugins.ide.eclipse.model.Container &&
it.path.contains('SCALA_CONTAINER') }
def scalaLib = classpath.entries.findAll
{it.toString().contains("scala-library")}
// Avoid problems with the Scala IDE
classpath.entries.removeAll(scalaLib)
// Change container order to support running unit tests
if(javaRuntime != null && scalaRuntime != null) {
classpath.entries.remove(javaRuntime)
classpath.entries.remove(scalaRuntime)
classpath.entries.add(scalaRuntime)
classpath.entries.add(javaRuntime)
}
}
}
}
}
/Jeppe