2013-08-22 33 views
2

當我運行「集結號」的命令由Scalatra的文檔作爲instrcuted(http://www.scalatra.org/2.2/guides/deployment/standalone.html)我得到以下錯誤:Scalatra的單機部署不能創建裝配

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

     ) 

    ) 

回答

1

首先,在build.scala你不必讓每個行之間空白行。

其次,SBT-組件的設置必須的項目設置的一部分,所以你必須在您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) 
    } 
    } 
) 
相關問題