62 lines
2.5 KiB
Scala
62 lines
2.5 KiB
Scala
import org.oggio88.sbt.{NimPlugin, WildflyPlugin}
|
|
import org.oggio88.sbt.ConfigurationFile._
|
|
|
|
name := "jpacrepo"
|
|
|
|
organization := "com.oggio88"
|
|
|
|
version := "2.0"
|
|
|
|
resolvers += Resolver.mavenLocal
|
|
|
|
libraryDependencies += "org.tukaani" % "xz" % "1.6"
|
|
libraryDependencies += "org.apache.commons" % "commons-compress" % "1.14"
|
|
libraryDependencies += "javax" % "javaee-api" % "7.0" % Provided
|
|
libraryDependencies += "org.hibernate" % "hibernate-jpamodelgen" % "5.3.6.Final" % Provided
|
|
|
|
libraryDependencies += "junit" % "junit" % "4.12" % Test
|
|
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
|
|
libraryDependencies += "com.thoughtworks.xstream" % "xstream" % "1.4.10" % Test
|
|
libraryDependencies += "commons-io" % "commons-io" % "2.5" % Test
|
|
libraryDependencies += "org.jboss" % "jboss-ejb-client" % "4.0.0.CR5" % Test
|
|
|
|
libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxrs" % "3.0.11.Final" % Test
|
|
libraryDependencies += "org.jboss.resteasy" % "resteasy-client" % "3.0.11.Final" % Test
|
|
libraryDependencies += "org.jboss.resteasy" % "resteasy-jackson-provider" % "3.0.11.Final" % Test
|
|
libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxb-provider" % "3.0.11.Final" % 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
|
|
|
|
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 |