Skip to content

Instantly share code, notes, and snippets.

@tkmtmkt
Created June 5, 2012 14:05
Show Gist options
  • Save tkmtmkt/2875217 to your computer and use it in GitHub Desktop.
Save tkmtmkt/2875217 to your computer and use it in GitHub Desktop.
sbtのディレクトリ構成をカスタマイズする設定を試してみた
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 sub1 = consoleProject("sub1", file("sub1"))
lazy val sub2 = webProject("sub2", file("sub2"))
def consoleProject(nameString: String, path: File) = Project(nameString, path) settings(
javacOptions in Compile := Seq("-encoding", "UTF-8", "-Xlint:unchecked"),
javaSource in Compile <<= sourceDirectory,
resourceDirectory in Compile <<= sourceDirectory,
includeFilter in unmanagedResources := "*.sql",
excludeFilter in unmanagedResources <<= (excludeFilter in unmanagedResources, includeFilter in unmanagedSources) { (excl, incl) => excl || incl }
)
def webProject(nameString: String, path: File) = Project(nameString, path) settings(
javacOptions in Compile := Seq("-encoding", "UTF-8", "-Xlint:unchecked"),
javaSource in Compile <<= sourceDirectory,
resourceDirectory in Compile <<= sourceDirectory,
includeFilter in unmanagedResources := "*.sql",
excludeFilter in unmanagedResources <<= (excludeFilter in unmanagedResources, includeFilter in unmanagedSources) { (excl, incl) => excl || incl },
sourceDirectory <<= baseDirectory / "WEB-INF/src",
unmanagedBase <<= baseDirectory / "WEB-INF/lib",
libraryDependencies ++= Seq(
"javax.servlet" % "servlet-api" % "2.5",
"junit" % "junit" % "4.10"
)
)
}
// vim: set ts=4 sw=4 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment