2

Scalatra ドキュメント ( http://www.scalatra.org/2.2/guides/deployment/standalone.html ) の指示に従って「アセンブリ」コマンドを実行すると、次のエラーが発生します。

[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

これは何を意味し、どのように修正できますか?

マージ戦略が最初に設定されている私のビルドファイルは次のとおりです。

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

        ) 

      ) 
4

1 に答える 1

1

まず、build.scala では、各行の間に空白行を入れる必要はありません。

次に、sbt-assembly の設定はプロジェクト設定の一部である必要があるため、Seq(...).

第三に、タイプが正しくないため、マージ戦略は機能しません。また、通常、すべてを最初に選択することはできません。次のようなものを試してください:

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)
    }
  }
)
于 2013-08-22T18:09:48.417 に答える