dcaoyuan/nbscala

[SBT] sources under other configurations (like it, for integration tests) not getting picked up.

Closed this issue · 3 comments

When using integration tests, sbt uses a source directory typically under src/it/scala, that directory is not picked up by the ide.

A workaround is to manually add it to the .classpath_nb.

@rcano - can you provide an example project (as simple as possible) where SBT is configured w/ integration tests ?

I was able to reproduce the issue w/o an example project from @rcano ; however, it seems that there is no need for a fix. In order to have the src/it/scala show up in the list of source roots. In my Build.scala, I added :
// import the netbeans plugin keys
import org.netbeans.nbsbt.core.NetBeansPlugin._

Then, add to the project settings, e.g. :

lazy val website = Project ("lift-quickstart-website", file("website"),
settings = BuildSettings.buildSettings ++ Seq (libraryDependencies ++= commonDeps ++ websiteDeps ++ Seq(
"org.eclipse.jetty" % "jetty-webapp" % "9.0.5.v20130815" % "container",
//next line needed cause of harrah/xsbt#499
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container" artifacts (Artifact("javax.servlet", "jar", "jar"))
)) ++ com.earldouglas.xsbtwebplugin.WebPlugin.webSettings ++ Seq(
scanDirectories in Compile := Nil,
port in config("container") := 8080
) ++ jrebelSettings ++ Seq (
jrebel.webLinks <++= webappResources in Compile
) ++ Seq (
NetBeansKeys.configurations := Set(Configurations.Compile, Configurations.Test, Configurations.IntegrationTest)

)

With this configuration when nbsbt regenerates the .classpath_nb file, it now includes an entry pointing to the src/it/scala folder, e.g.

IMO, this issue can be closed as invalid (maybe some documentation is needed, but this is already supported by nbsbt out of the box).

rcano commented

Oh, thanks, I agree. I'm closing it.