dimanche 25 janvier 2015

Skipping tests in assembly not working with sbt-onejar

Can someone help troubleshoot this project file for the reason why tests always run despite having test in assembly := {} there?



import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
import com.github.retronym.SbtOneJar
import com.earldouglas.xsbtwebplugin.PluginKeys._
import com.earldouglas.xsbtwebplugin.WebPlugin._
import sbtassembly.Plugin._
import AssemblyKeys._
import sbtassembly.Plugin.AssemblyKeys._


object MyAppBuild extends Build {
val Organization = "my.organization"
val Name = "myapp"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.11.1"
val ScalatraVersion = "2.3.0"

// settings for sbt-assembly plugin
val myAssemblySettings = assemblySettings ++ Seq(

// handle conflicts during assembly task
mergeStrategy in assembly <<= (mergeStrategy in assembly) {
(old) => {
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "unwanted.txt" => MergeStrategy.discard
case x => old(x)
}
},

// copy web resources to /webapp folder
resourceGenerators in Compile <+= (resourceManaged, baseDirectory) map {
(managedBase, base) =>
val webappBase = base / "src" / "main" / "webapp"
for {
(from, to) <- webappBase ** "*" x rebase(webappBase, managedBase / "main" / "webapp")
} yield {
Sync.copy(from, to)
to
}
}
)

lazy val project = Project (
"myapp",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++
SbtOneJar.oneJarSettings ++
scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
port in container.Configuration := 9000,

/****** This has no effect *****/
test in assembly := {},
/*******************************/

resolvers ++= Seq (Classpaths.typesafeReleases,
"anormcypher" at "http://ift.tt/1yMzoSx"
/** other repos skipped */

libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % ScalaVersion,
"org.scala-lang" % "scala-compiler" % ScalaVersion,
"org.scalaz" %% "scalaz-core" % "7.0.6",
/** other dependencies skipped */

),
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile){ base =>
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq(
Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
), /* add extra bindings here */
Some("templates")
)
)
}
)
).settings(myAssemblySettings:_*)
.settings( parallelExecution in ThisBuild := false : _* )

}

Aucun commentaire:

Enregistrer un commentaire