Scala 为什么sbt编译不';是否不将非托管资源复制到类路径?

Scala 为什么sbt编译不';是否不将非托管资源复制到类路径?,scala,sbt,scala-2.10,Scala,Sbt,Scala 2.10,您能告诉我为什么sbt compile不将非托管资源复制到类路径吗?另一方面,sbt包。因此,除非手动调用packagecall,否则无法启动调试:( 我使用的是SBT 0.12.1 下面是我的build.sbt import AssemblyKeys._ // put this at the top of the file net.virtualvoid.sbt.graph.Plugin.graphSettings assemblySettings organization := "c

您能告诉我为什么
sbt compile
不将非托管资源复制到类路径吗?另一方面,
sbt包
。因此,除非手动调用
package
call,否则无法启动调试:(

我使用的是SBT 0.12.1

下面是我的build.sbt

import AssemblyKeys._ // put this at the top of the file

net.virtualvoid.sbt.graph.Plugin.graphSettings

assemblySettings

organization  := "com.zzz"

version       := "0.1"

scalaVersion  := "2.10.2"

scalacOptions := Seq("-unchecked", "-language:reflectiveCalls,postfixOps,implicitConversions", "-deprecation", "-feature", "-encoding", "utf8")

unmanagedResourceDirectories in Compile <++= baseDirectory { base =>
    Seq( base / "src/main/webapp" )
}

jarName in assembly := "zzz.jar"

mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
    {
        case "rootdoc.txt" => MergeStrategy.discard
        case x => old(x)
    }
}

mainClass in assembly := Some("com.zzz.Boot")

name := "zzz"

// disable using the Scala version in output paths and artifacts
crossPaths := false

artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
  artifact.name + "." + artifact.extension
}

resolvers ++= Seq(
  "spray repo" at "http://repo.spray.io/"
)

libraryDependencies ++= {
  val sprayVersion = "1.2-M8"
  val akkaVersion  = "2.2.0-RC1"
Seq(
  "io.spray"            %   "spray-servlet" % sprayVersion withSources(),
  "io.spray"            %   "spray-can"     % sprayVersion withSources(),
  "io.spray"            %   "spray-routing" % sprayVersion withSources(),
  "com.typesafe.akka"   %%  "akka-actor"    % akkaVersion,
  "org.eclipse.jetty"       %   "jetty-webapp"  % "8.1.7.v20120910"     % "container",
  "org.eclipse.jetty.orbit" %   "javax.servlet" % "3.0.0.v201112011016" % "container"  artifacts Artifact("javax.servlet", "jar", "jar"),
  "net.sourceforge.htmlcleaner" % "htmlcleaner" % "2.2",
  "org.apache.httpcomponents" % "httpclient" % "4.2.3",
  "org.apache.commons" % "commons-lang3" % "3.1",
  "org.mongodb" %% "casbah" % "2.6.0",
  "com.romix.scala" % "scala-kryo-serialization" % "0.2-SNAPSHOT",
  "org.codehaus.jettison" % "jettison" % "1.3.3",
  "com.osinka.subset" %% "subset" % "2.0.1",
  "io.spray" %% "spray-json" % "1.2.5" intransitive()
)
}

seq(Revolver.settings: _*)

seq(webSettings: _*)

seq(Twirl.settings: _*)
import AssemblyKeys.\u//将其放在文件的顶部
net.virtualvoid.sbt.graph.Plugin.graphSettings
装配设置
组织机构:=“com.zzz”
版本:=“0.1”
规模规避:=“2.10.2”
scalacOptions:=Seq(“-unchecked”,“-language:reflectiveCalls,postfixOps,implicitConversions”,“-deprecation”,“-feature”,“-encoding”,“utf8”)
编译中的非托管源目录
Seq(base/“src/main/webapp”)
}
程序集中的jarName:=“zzz.jar”
程序集mergeStrategy.discard中的mergeStrategy
案例x=>旧(x)
}
}
程序集中的mainClass:=Some(“com.zzz.Boot”)
名称:=“zzz”
//禁用在输出路径和工件中使用Scala版本
交叉点:=假
工件名称:={(sv:ScalaVersion,module:ModuleID,工件:工件)=>
artifact.name+“+”artifact.extension
}
分解器+++=Seq(
“喷射式回购”在http://repo.spray.io/"
)
libraryDependencies++={
val version=“1.2-M8”
val akkaVersion=“2.2.0-RC1”
序号(
“io.spray”%”spray servlet“%sprayVersion WITHOURCES(),
“io.spray”%喷雾罐“%sprayVersion with Sources(),
“io.spray”%”喷洒路由“%sprayVersion WITHOURCES(),
“com.typesafe.akka”%%“akka演员”%akkaVersion,
“org.eclipse.jetty”%”jetty webapp“%”8.1.7.v20120910“%”容器“,
“org.eclipse.jetty.orbit”%”javax.servlet“%”3.0.0.v201112011016“%”容器“工件工件工件(“javax.servlet”、“jar”、“jar”),
“net.sourceforge.htmlcleaner”%“htmlcleaner”%“2.2”,
“org.apache.httpcomponents”%”httpclient“%”4.2.3“,
“org.apache.commons”%“commons-lang3”%“3.1”,
“org.mongodb”%%“casbah”%%“2.6.0”,
“com.romix.scala”%“scala kryo序列化”%“0.2-SNAPSHOT”,
“org.codehaus.jettison”%“jettison”%“1.3.3”,
“com.osinka.subset”%%“subset”%%“2.0.1”,
“io.spray”%%“spray json”%%“1.2.5”不及物()
)
}
序号(左轮手枪设置:*)
序号(网站设置:*)
顺序(旋转设置:*)

编译的工作是编译源代码,因此它通常不会执行任何与处理资源相关的操作。但是,资源需要位于类目录中,以便运行
运行
测试
控制台
,以及使用
完整类路径
的任何其他操作都可以完成通过
fullClasspath
组合
exportedProducts
,它们是当前项目生成的类和资源,以及
dependencyClasspath
,它们是依赖项中的类路径条目

适当的解决方案取决于所需的资源。从命令行运行
导出的产品
以执行
编译
以及
复制资源
。以编程方式,您通常需要依赖
完整类路径
导出的产品


作为旁注,您通常可以找到哪些任务使用什么。

什么是
显示编译:非托管资源目录
返回?@AlexIv
[info]列表(C:\work\sideprojects\courierapp\server\src\main\resources,C:\work\sideprojects\courierapp\server\src\main\webapp)
您不能只使用默认包含的
src/main/resources/webapp