Skip to content

Instantly share code, notes, and snippets.

@natbusa
Created January 4, 2013 22:52
Show Gist options
  • Save natbusa/4458230 to your computer and use it in GitHub Desktop.
Save natbusa/4458230 to your computer and use it in GitHub Desktop.
sbt settings for scala and hibernate
import sbt._
import Keys._
object BuildSettings {
val buildOrganization = "http://natalino.busa.nl"
val buildVersion = "1.0.0"
val buildScalaVersion = "2.9.2"
val buildSettings = Defaults.defaultSettings ++ Seq (
organization := buildOrganization,
version := buildVersion,
scalaVersion := buildScalaVersion,
shellPrompt := ShellPrompt.buildShellPrompt,
scalacOptions := Seq("-deprecation", "-encoding", "utf8")
)
}
// Shell prompt which show the current project,
// git branch and build version
object ShellPrompt {
object devnull extends ProcessLogger {
def info (s: => String) {}
def error (s: => String) { }
def buffer[T] (f: => T): T = f
}
def currBranch = (
("git status -sb" lines_! devnull headOption)
getOrElse "-" stripPrefix "## "
)
val buildShellPrompt = {
(state: State) => {
val currProject = Project.extract (state).currentProject.id
"%s:%s:%s> ".format (
currProject, currBranch, BuildSettings.buildVersion
)
}
}
}
object Resolvers {
val MavenRepo = "Maven repository" at "http://repo1.maven.org/maven2/"
val JBossRepo = "JBoss repository" at "https://repository.jboss.org/nexus/content/groups/public/"
val allResolvers = Seq (MavenRepo, JBossRepo)
}
object Dependencies {
val allDependencies = Seq(
"org.hibernate" % "hibernate-core" % "4.1.8.Final",
"org.hibernate" % "hibernate-entitymanager" % "4.1.8.Final",
"org.hsqldb" % "hsqldb" % "2.2.8",
"org.slf4j" % "slf4j-api" % "1.6.1",
"org.slf4j" % "slf4j-log4j12" % "1.6.1",
"log4j" % "log4j" % "1.2.16"
)
}
object DefaultBuild extends Build {
import Resolvers._
import Dependencies._
import BuildSettings._
val appName = "HibernateJpaScalaTutorial"
val appVersion = "1.0"
lazy val root = Project (
id = appName,
base = file ("."),
settings = buildSettings ++ Seq (resolvers ++= allResolvers, libraryDependencies ++= allDependencies)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment