2

When I run the "assembly" command as instrcuted by the Scalatra docs (http://www.scalatra.org/2.2/guides/deployment/standalone.html) I get the following error:

[trace] Stack trace suppressed: run last *:assembly for the full output.
[error] (*:assembly) deduplicate: different file contents found in the following:
[error] /home/nick/.ivy2/cache/org.eclipse.jetty.orbit/javax.servlet/orbits/javax.servlet-3.0.0.v201112011016.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-8.1.8.v20121106.jar:about.html
[error] /home/nick/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-8.1.8.v20121106.jar:about.html

What does this mean, and how can it be fixed?

Here is my build file with merge strategy being set to first:

import sbt._

import Keys._

import org.scalatra.sbt._

import org.scalatra.sbt.PluginKeys._

import com.mojolly.scalate.ScalatePlugin._

import ScalateKeys._

import sbtassembly.Plugin._

import AssemblyKeys._



object MyScalatraWebAppBuild extends Build {

  val Organization = "com.example"

  val Name = "My Scalatra Web App"

  val Version = "0.1.0-SNAPSHOT"

  val ScalaVersion = "2.10.2"

  val ScalatraVersion = "2.2.1"



  mergeStrategy in assembly := mergeStrategy.first

  jarName in assembly := "scalatra_atmosphere_demo.jar"



      lazy val project = Project (

        "my-scalatra-web-app",

        file("."),

        settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ assemblySettings ++ Seq(

          organization := Organization,

          name := Name,

          version := Version,

          scalaVersion := ScalaVersion,

          resolvers += Classpaths.typesafeReleases,

          libraryDependencies ++= Seq(

            "org.scalatra" %% "scalatra" % ScalatraVersion,

            "org.scalatra" %% "scalatra-scalate" % ScalatraVersion,

            "org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",

            "ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime",

            "org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "container;compile",

            "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar")),

            "org.scalatra" %% "scalatra-atmosphere" % "2.2.1",

            "org.scalatra" %% "scalatra-json" % "2.2.1",

            "org.json4s"   %% "json4s-jackson" % "3.2.4",

            "org.eclipse.jetty" % "jetty-websocket" % "8.1.10.v20130312" % "container" 

          ),

          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")

              )

            )

          },

          resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

        ) 

      ) 
user2668128
  • 39,482
  • 8
  • 27
  • 34

1 Answers1

1

First, in build.scala you don't have to have blank lines between each lines.

Second, the settings for sbt-assembly needs to be part of the project settings, so you have to include that somewhere in your Seq(...).

Third, your merge strategy won't work since the type is incorrect, and you can't usually pick first for everything. You should try something like:

Seq(
  organization := Organization,
  name := Name,
  ....

  jarName in assembly := "scalatra_atmosphere_demo.jar",
  mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
    {
      case PathList(xs @ _*) if xs.last endsWith ".html" => MergeStrategy.first
      case x => old(x)
    }
  }
)
Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319