Skip to content

Instantly share code, notes, and snippets.

@yamashiro
Created May 17, 2012 12:46
Show Gist options
  • Save yamashiro/2718678 to your computer and use it in GitHub Desktop.
Save yamashiro/2718678 to your computer and use it in GitHub Desktop.
マルチプロジェクトなBuild.scala
import sbt._
import Keys._
import com.github.retronym.SbtOneJar
import scala._
object Build extends Build {
val specs = "org.specs2" %% "specs2" % "1.9" % "test"
val specsResolver = Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"releases" at "http://oss.sonatype.org/content/repositories/releases")
val mysqlDriver = "mysql" % "mysql-connector-java" % "5.1.19" % "runtime"
val squeryl = "org.squeryl" %% "squeryl" % "0.9.5"
lazy val dependencies = Seq(specs, mysqlDriver, squeryl)
val hello = TaskKey[Unit]("hello")
val helloTask = hello := {
println("hello")
}
val standardSettings = Seq(
exportJars := true,
scalaVersion := "2.9.2",
libraryDependencies ++= dependencies,
resolvers ++= specsResolver
) ++ Defaults.defaultSettings ++ Seq(helloTask)
lazy val root = Project(id = "root",
base = file(".")) aggregate(core, sample)
lazy val helloCompile = (compile in Compile) <<= compile in Compile dependsOn (hello)
lazy val core = Project("core",
file("core"),
settings = standardSettings ++ Seq(helloCompile))
lazy val sample = Project("sample",
file("sample"),
settings = standardSettings ++ SbtOneJar.oneJarSettings ++
Seq(helloCompile)
) dependsOn(core)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment