migrated to sbt-misc-plugin
This commit is contained in:
117
build.sbt
117
build.sbt
@@ -1,6 +1,5 @@
|
||||
import java.nio.file.{Files, StandardCopyOption}
|
||||
|
||||
import xsbti.compile.CompileAnalysis
|
||||
import org.oggio88.sbt.{NimPlugin, WildflyPlugin}
|
||||
import org.oggio88.sbt.ConfigurationFile._
|
||||
|
||||
name := "jpacrepo"
|
||||
|
||||
@@ -9,93 +8,55 @@ organization := "com.oggio88"
|
||||
version := "2.0"
|
||||
|
||||
resolvers += Resolver.mavenLocal
|
||||
scalaVersion := "2.12.2"
|
||||
|
||||
libraryDependencies += "org.tukaani" % "xz" % "1.6"
|
||||
libraryDependencies += "org.apache.commons" % "commons-compress" % "1.14"
|
||||
libraryDependencies += "javax" % "javaee-api" % "7.0" % "provided"
|
||||
//libraryDependencies += "javax" % "javaee-api" % "7.0 "
|
||||
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.hibernate.javax.persistence" % "hibernate-jpa-2.0-api" % "1.0.1.Final"
|
||||
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.hibernate" % "hibernate-jpamodelgen" % "5.2.10.Final" % "provided"
|
||||
|
||||
//libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxrs" % "3.1.3.Final" % "test"
|
||||
//libraryDependencies += "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final"
|
||||
//libraryDependencies += "org.jboss.resteasy" % "resteasy-jackson-provider" % "3.1.3.Final" % "test"
|
||||
//libraryDependencies += "com.fasterxml.jackson.core" % "jackson-core" % "2.9.0.pr4"
|
||||
|
||||
//libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxb-provider" % "3.1.3.Final" % "test"
|
||||
//libraryDependencies += "org.jboss.spec.javax.servlet" % "jboss-servlet-api_3.1_spec" % "1.0.0.Final" % "provided"
|
||||
//libraryDependencies += "org.jboss.spec.javax.ws.rs" % "jboss-jaxrs-api_2.0_spec" % "1.0.0.Final"
|
||||
|
||||
libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxrs" % "3.0.11.Final"
|
||||
libraryDependencies += "org.jboss.resteasy" % "resteasy-client" % "3.0.11.Final"
|
||||
libraryDependencies += "org.jboss.resteasy" % "resteasy-jackson-provider" % "3.0.11.Final"
|
||||
libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxb-provider" % "3.0.11.Final"
|
||||
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)
|
||||
|
||||
artifactName :=
|
||||
{ (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
|
||||
artifact.name + "-" + module.revision + "." + artifact.extension
|
||||
}
|
||||
nimCompilerParameters in CompileNim := Seq("-d:release", "-d:serverURL=")
|
||||
sources in CompileNim := Seq(baseDirectory.value / "nim" / "src" / "jpacrepo.nim")
|
||||
|
||||
//javacOptions += "-g"
|
||||
webappWebInfClasses := true
|
||||
|
||||
val compileNim = TaskKey[File]("compileNim", "Compile nim code of web interface", KeyRanks.ATask)
|
||||
compileNim :=
|
||||
webappPostProcess := {
|
||||
val baseDir = baseDirectory.value / "nim" / "static"
|
||||
val nimOutput = (compileNim in CompileNim).value
|
||||
println(nimOutput)
|
||||
webappDir: File =>
|
||||
{
|
||||
val result = new File("nim/nimcache/jpacrepo.js")
|
||||
val cmd = s"nim js -d:release -d:serverURL= nim/src/jpacrepo.nim"
|
||||
println(cmd)
|
||||
sys.process.stringToProcess(cmd).! match
|
||||
{
|
||||
case 0 =>
|
||||
case _ => throw new RuntimeException("Error occurred during deploy")
|
||||
}
|
||||
result
|
||||
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")
|
||||
|
||||
webappPostProcess :=
|
||||
{
|
||||
val baseDir = baseDirectory.value / "nim" / "static"
|
||||
val nimOutput = compileNim.value
|
||||
webappDir: File =>
|
||||
{
|
||||
IO.copyFile(baseDir / "index.html", webappDir / "index.html")
|
||||
IO.copyFile(baseDir / "jpacrepo.css", webappDir / "jpacrepo.css")
|
||||
IO.copyFile(nimOutput, webappDir / "jpacrepo.js")
|
||||
}
|
||||
}
|
||||
dataSourceJNDI := "java:/PostgresDS"
|
||||
dataBaseAction := "none"
|
||||
|
||||
val wildflyUsername = SettingKey[String]("wildfly-username", "The account username to use to connect to wildfly with jboss-cli.sh")
|
||||
val wildflyPassword = SettingKey[String]("wildfly-password", "The account password to use to connect to wildfly with jboss-cli.sh")
|
||||
val wildflyURL = SettingKey[String]("wildfly-url", "The username to use to connect to wildfly with jboss-cli.sh")
|
||||
|
||||
wildflyUsername := "admin"
|
||||
wildflyPassword := "123456"
|
||||
wildflyURL := "localhost:1234"
|
||||
|
||||
val deploy2Wildfly = TaskKey[Unit]("deploy2Wildfly", "Deploy to a wildfly server instance", KeyRanks.ATask)
|
||||
|
||||
deploy2Wildfly :=
|
||||
{
|
||||
val cmd = s"/opt/wildfly/bin/jboss-cli.sh " +
|
||||
s"--controller='${wildflyURL.value}' " +
|
||||
s"--connect --user='${wildflyUsername.value}' " +
|
||||
s"--password='${wildflyPassword.value}' " +
|
||||
s"--command=\'deploy ${(packagedArtifact in(Compile, Keys.`package`)).value._2} --force\'"
|
||||
println(cmd)
|
||||
sys.process.stringToProcess(cmd).! match
|
||||
{
|
||||
case 0 =>
|
||||
case _ => throw new RuntimeException("Error occurred during deploy")
|
||||
}
|
||||
}
|
||||
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
|
Reference in New Issue
Block a user