Skip to content

Instantly share code, notes, and snippets.

@tkmtmkt
Created August 4, 2012 04:57
Show Gist options
  • Save tkmtmkt/3254633 to your computer and use it in GitHub Desktop.
Save tkmtmkt/3254633 to your computer and use it in GitHub Desktop.
標準のディレクトリ構成を変更するscala設定ファイル(Full:マルチプロジェクト)
import sbt._
import Keys._
object TestBuild extends Build {
lazy val root: Project = Project("root", file("."), aggregate = nonRoots)
lazy val nonRoots = projects.filter(_ != root).map(p => LocalProject(p.id))
lazy val main = consoleProject("main", file("main")) dependsOn(sub1, sub2, sub3)
lazy val sub1 = webProject("sub1", file("sub1"))
lazy val sub2 = webProject("sub2", file("sub2"))
lazy val sub3 = webProject("sub3", file("sub3"))
def consoleProject(nameString: String, path: File) = Project(nameString, path) settings(
unmanagedBase <<= baseDirectory / "lib",
sourceDirectory in Test <<= baseDirectory / "test",
sourceDirectory in Compile <<= baseDirectory / "src",
javacOptions in Compile := Seq("-encoding", "UTF-8", "-Xlint"),
javaSource in Compile <<= sourceDirectory in Compile,
scalaSource in Compile <<= sourceDirectory in Compile,
resourceDirectory in Compile <<= sourceDirectory in Compile,
includeFilter in unmanagedResources := "*.properties",
excludeFilter in unmanagedResources <<= (excludeFilter in unmanagedResources, includeFilter in unmanagedSources) { (excl, incl) => excl || incl },
libraryDependencies ++= Seq(
"junit" % "junit" % "4.10" % "test",
"org.specs2" %% "specs2" % "1.11" % "test",
"org.mockito" % "mockito-core" % "1.9.0" % "test"
)
)
def webProject(nameString: String, path: File) = Project(nameString, path) settings(
unmanagedBase <<= baseDirectory / "WEB-INF/lib",
sourceDirectory in Test <<= baseDirectory / "WEB-INF/test",
sourceDirectory in Compile <<= baseDirectory / "WEB-INF/src",
javacOptions in Compile := Seq("-encoding", "UTF-8", "-Xlint"),
javaSource in Compile <<= sourceDirectory in Compile,
scalaSource in Compile <<= sourceDirectory in Compile,
resourceDirectory in Compile <<= sourceDirectory in Compile,
includeFilter in unmanagedResources := "*.properties",
excludeFilter in unmanagedResources <<= (excludeFilter in unmanagedResources, includeFilter in unmanagedSources) { (excl, incl) => excl || incl },
libraryDependencies ++= Seq(
"javax.servlet" % "servlet-api" % "2.5" % "provided",
"junit" % "junit" % "4.10" % "test",
"org.specs2" %% "specs2" % "1.11" % "test",
"org.mockito" % "mockito-core" % "1.9.0" % "test"
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment