1

I have tests under sbt's unmanagedSourceDirectories in the IntegrationTest configuration that I want to keep separate from the Test configuration.

Is there a way to have sbteclipse add that source directory to the eclipse .classpath file without adding it to the Compile or Test configuration?

GreenMachine
  • 342
  • 2
  • 10

2 Answers2

3

It looks like the way to do this is to add the following setting to you build.sbt:

EclipseKeys.configurations := Set(Compile, Test, IntegrationTest)

Where Compile and Test are the defaults and I just added the IntegrationTest configuration that I wanted to be added.

GreenMachine
  • 342
  • 2
  • 10
1

If you don't want to put Eclipse-specific configuration in your SBT files you can set-up Eclipse to run integration tests globally as follows:

Add the following to your ~/.sbt/0.13/plugins/plugins.sbt file:

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "3.0.0")

And then create ~/.sbt/0.13/plugins/Eclipse.scala as a file with the following contents:

import sbt._
import Keys._
import com.typesafe.sbteclipse.plugin.EclipsePlugin._

object ShellPrompt extends Plugin {
  override def settings = Seq(
    EclipseKeys.configurations := Set(Configurations.Compile, Configurations.Test, Configurations.IntegrationTest)
  )
}
Ricardo Gladwell
  • 3,770
  • 4
  • 38
  • 59
  • 1
    Thanks, this is very helpful to keep the IDE-specific configs out of specific projects. Unfortunately, if you have any projects that don't have ``IntegrationTest`` you run in to https://github.com/typesafehub/sbteclipse/issues/154. I wonder if there is a way to check whether the specific project even has ``IntegrationTest`` first. – Chad Retz Jul 20 '15 at 01:00