How can I show a source directory to sbteclipse without adding it to the Compile or Test configuration

StackOverflow https://stackoverflow.com/questions/23229864

  •  07-07-2023
  •  | 
  •  

質問

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?

役に立ちましたか?

解決

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.

他のヒント

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)
  )
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top