Performance Tool(5)Upgrade to 2.0.x
But not finished at last.
Just successfully set up the Build.scala an etc as follow:
build.properties
sbt.version=0.13.5
plugins.sbt
addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.7.0-SNAPSHOT")
addSbtPlugin("io.gatling" % "sbt-plugin" % "1.0-RC1")
Dependency.scala
import sbt._
object Dependencies {
val gatling_version = "2.0.0-RC2"
val log4j = "log4j" % "log4j" % "1.2.17"
val gatling = "io.gatling.highcharts" % "gatling-charts-highcharts" % gatling_version
val baseDeps = Seq (
log4j,
gatling
)
}
Resolvers.scala
import sbt._
object Resolvers {
val local = Resolver.defaultLocal
val local_maven = "Local Maven repo" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
val maven = "MAVEN repo" at "http://repo1.maven.org/maven2"
val sonatype = "sonatype releases" at "https://oss.sonatype.org/content/repositories/releases/"
val sona_snap = "sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
val typsafe = "typesafe repo" at "http://repo.typesafe.com/typesafe/releases/"
val spary = "spray repo" at "http://repo.spray.io/"
val spary2 = "Spray repo second" at "http://repo.spray.cc/"
val akka = "Akka repo" at "http://repo.akka.io/releases/"
val scala_tools = "Scala Tools" at "http://scala-tools.org/repo-releases/"
val excilys = "Excilys" at "http://repository.excilys.com/content/groups/public"
val excilys_snap ="Excilys Snapshot" at "http://repository-gatling.forge.cloudbees.com/snapshot"
val spray_nightly="spray nightlies" at "http://nightlies.spray.io"
val myResolvers = Seq (
local,
local_maven,
maven,
sonatype,
sona_snap,
typsafe,
spary,
spary2,
akka,
scala_tools,
excilys_snap,
spray_nightly
)
}
Build.scala
import sbt._
import sbt.Keys._
import Resolvers._
import Dependencies._
import sbtassembly.Plugin._
import sbtassembly.AssemblyUtils._
import AssemblyKeys._
import BuildSettings._
import io.gatling.sbt.GatlingPlugin
object BuildSettings {
val projectName = "sillycat-gatling"
val buildSettings = Seq(
organization := "org.sillycat",
version := "1.0.0",
scalaVersion := "2.10.4",
crossScalaVersions := Seq("2.10.2", "2.10.3", "2.10.4", "2.11.0", "2.11.1", "2.11.2"),
scalacOptions ++= Seq()
)
}
object ApplicationBuild extends Build {
lazy val main = Project(
BuildSettings.projectName,
file("."),
settings = BuildSettings.buildSettings ++ assemblySettings
++
Seq(resolvers := myResolvers,
libraryDependencies ++= baseDeps,
mergeStrategy in assembly := mergeFirst
)
)
.enablePlugins(GatlingPlugin)
.settings(
mainClass in assembly := Some("com.sillycat.gatling.app.ExecutorApp"),
excludedJars in assembly <<= (fullClasspath in assembly) map { cp =>
cp filter {_.data.getName == "compile-0.1.0.jar"}
},
artifact in (Compile, assembly) ~= { art =>
art.copy(`classifier` = Some("assembly"))
}
)
lazy val mergeFirst: String => MergeStrategy = {
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", "jasper", xs @ _*) => MergeStrategy.first
case PathList("org", "fusesource", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", "commons", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", "commons", "beanutils", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", "commons", "collections", xs @ _*) => MergeStrategy.first
case PathList("com", "esotericsoftware", "minlog", xs @ _*) => MergeStrategy.first
case PathList("org", "eclipse", xs @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) =>
(xs map {_.toLowerCase}) match {
case ("changes.txt" :: Nil ) =>
MergeStrategy.discard
case ("manifest.mf" :: Nil) | ("eclipsef.rsa" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) =>
MergeStrategy.discard
case ps @ (x :: xs) if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") || ps.last.endsWith("pom.properties") || ps.last.endsWith("pom.xml") =>
MergeStrategy.discard
case "plexus" :: xs =>
MergeStrategy.discard
case "services" :: xs =>
MergeStrategy.filterDistinctLines
case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) =>
MergeStrategy.filterDistinctLines
case ps @ (x :: xs) if ps.last.endsWith(".jnilib") || ps.last.endsWith(".dll") =>
MergeStrategy.first
case ps @ (x :: xs) if ps.last.endsWith(".txt") =>
MergeStrategy.discard
case ("notice" :: Nil) | ("license" :: Nil) | ("mailcap" :: Nil )=>
MergeStrategy.discard
case _ => MergeStrategy.deduplicate
}
case "application.conf" => MergeStrategy.concat
case "about.html" => MergeStrategy.discard
case "plugin.properties" => MergeStrategy.first
case _ => MergeStrategy.first
}
}
References:
http://sillycat.iteye.com/blog/1829699
http://sillycat.iteye.com/blog/1994160
http://sillycat.iteye.com/blog/2096198
http://sillycat.iteye.com/blog/2108460
https://github.com/gatling/gatling-sbt
gatling Source codes
https://github.com/gatling/gatling/blob/2.0.0-M3X/gatling-app/src/main/scala/io/gatling/app/Gatling.scala
plugins Source codes
https://github.com/gatling/gatling-sbt/blob/master/test-framework/src/main/scala/io/gatling/sbt/GatlingTask.scala