74 lines
3.0 KiB
Scala
74 lines
3.0 KiB
Scala
import org.oggio88.sbt.{NimPlugin, WildflyPlugin}
|
|
import org.oggio88.sbt.ConfigurationFile._
|
|
|
|
name := "jpacrepo"
|
|
|
|
organization := "net.woggioni"
|
|
|
|
version := "2.0"
|
|
|
|
resolvers += Resolver.mavenLocal
|
|
|
|
scalaVersion := "2.13.2"
|
|
|
|
libraryDependencies += "org.tukaani" % "xz" % Versions.xz
|
|
libraryDependencies += "org.slf4j" % "slf4j-api" % Versions.slf4j
|
|
libraryDependencies += "net.woggioni" % "jzstd" % Versions.jzstd
|
|
libraryDependencies += "net.woggioni" % "jwo" % Versions.jwo
|
|
libraryDependencies += "org.apache.commons" % "commons-compress" % Versions.`common-compress`
|
|
|
|
libraryDependencies += "org.hibernate" % "hibernate-jpamodelgen" % Versions.hibernate % Provided
|
|
libraryDependencies += "org.projectlombok" % "lombok" % Versions.lombok % Provided
|
|
libraryDependencies += "javax" % "javaee-api" % Versions.javaee % Provided
|
|
|
|
libraryDependencies += "org.jboss" % "jboss-ejb-client" % Versions.jbossEjbClient % Test
|
|
libraryDependencies += "org.apache.logging.log4j" % "log4j-slf4j-impl" % Versions.log4j % Test
|
|
|
|
libraryDependencies += "org.jboss.weld.se" % "weld-se-core" % Versions.weld % Test
|
|
libraryDependencies += "com.h2database" % "h2" % Versions.h2 % Test
|
|
libraryDependencies += "org.hibernate" % "hibernate-core" % Versions.hibernate % Test
|
|
|
|
libraryDependencies += "org.jboss.resteasy" % "resteasy-client" % Versions.restEasy % Test
|
|
libraryDependencies += "org.jboss.resteasy" % "resteasy-jackson2-provider" % Versions.restEasy % Test
|
|
libraryDependencies += "org.scalatest" %% "scalatest" % Versions.scalatest % Test
|
|
|
|
|
|
enablePlugins(WarPlugin)
|
|
enablePlugins(WildflyPlugin)
|
|
enablePlugins(NimPlugin)
|
|
|
|
nimCompilerParameters in CompileNim := Seq("-d:release", "-d:serverURL=")
|
|
sources in CompileNim := Seq(baseDirectory.value / "nim" / "src" / "jpacrepo.nim")
|
|
|
|
webappWebInfClasses := true
|
|
|
|
|
|
Test / run / javaOptions += "-Dnet.woggioni.jpacrepo.configuration.file=conf/server.properties"
|
|
Test / run / fork := true
|
|
|
|
webappPostProcess := {
|
|
val baseDir = baseDirectory.value / "nim" / "static"
|
|
val nimOutput = (compileNim in CompileNim).value
|
|
println(nimOutput)
|
|
webappDir: File => {
|
|
IO.copyFile(baseDir / "index.html", webappDir / "index.html")
|
|
IO.copyFile(baseDir / "jpacrepo.css", webappDir / "jpacrepo.css")
|
|
nimOutput.foreach(file => IO.copyFile(file, webappDir / file.getName))
|
|
}
|
|
}
|
|
|
|
|
|
lazy val datasourceJNDI = SettingKey[String]("datasource-jndi", "JNDI name of the application datasource")
|
|
lazy val databaseAction = SettingKey[String]("database-action",
|
|
"value of the property \"javax.persistence.schema-generation.database.action\" in the persistence unit")
|
|
|
|
datasourceJNDI := "java:/PostgresDS"
|
|
databaseAction := "none"
|
|
|
|
resourceGenerators in Compile += Def.task({
|
|
Seq(IO.configureFile(
|
|
(sourceDirectory in Compile).value / "resources-template" / "persistence.xml",
|
|
(resourceManaged in Compile).value / "META-INF" / "persistence.xml",
|
|
Map("dataSourceJNDI" -> datasourceJNDI.value,
|
|
"dataBaseAction" -> databaseAction.value)))
|
|
}).taskValue |