If you’re using sbteclipse in a SBT project and there are no Java files in your project, you don’t need of both src/main/java and src/test/java folders. But every time you run “sbt eclipse”, the Java folders are regenerated.
There is a way to prevent those directories from being generated. To do that you need to avoid the Java source directories to be created, simply redefine unmanagedSourceDirectories by adding these two settings:
1
2
unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)(Seq(_)),
unmanagedSourceDirectories in Test <<= (scalaSource in Test)(Seq(_))
And it’s an example of a build.scala file, see how you can add those settings:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
object AppBuilder extends Build {
val appSettings = Seq(
name := "apptest",
organization := "com.rlazoti",
version := "0.0.1-SNAPSHOT",
scalaVersion := "2.10.2",
unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)(Seq(_)),
unmanagedSourceDirectories in Test <<= (scalaSource in Test)(Seq(_))
)
lazy val app = Project("apptest", file("."))
.settings(appSettings : _*)
}