2013-07-10 1 views
11

sbt compile이 관리되지 않는 리소스를 classpath에 복사하지 않는 이유를 말씀해 주시겠습니까? 반면에 sbt package은 그렇지 않습니다. 내가 package 전화가 수동으로 다음 sbt compile이 관리되지 않는 리소스를 classpath에 복사하지 않는 이유는 무엇입니까?

내 build.sbt입니다 내가 SBT 0.12.1을 사용하고

:(호출하지 않는 한 그 결과 나는 디버깅을 시작할 수 없습니다.

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: _*) 
+0

'show compile : unmanaged-resource-directories'는 무엇을 반환합니까? – 4lex1v

+0

@AlexIv'[정보] 목록 (C : \ work \ sideprojects \ courierapp \ 서버 \ src \ main \ resources, C : \ work \ sideprojects \ courierapp \ server \ src \ main \ webapp)' – expert

+1

기본적으로 포함될'src/main/resources/webapp'을 사용 하시겠습니까? –

답변

16

compile의 작업을 소스를 컴파일하는 것이므로 일반적으로 처리 리소스와 관련된 작업은 수행하지 않지만 리소스는 run, package, test, consolefullClasspath을 사용하는 클래스 디렉토리에 있어야합니다. fullClasspath은 현재 프로젝트에서 생성 된 클래스 및 리소스 인 exportedProducts과 종속성의 클래스 경로 항목 인 dependencyClasspath을 결합합니다.

적절한 해결책은 리소스가 필요한 대상에 따라 다릅니다. 명령 줄에서 compilecopy-resources을 수행하려면 exported-products을 실행하십시오. 프로그래밍 방식으로 일반적으로 fullClasspath 또는 exportedProducts에 의존하려고합니다.

보조 노트로 일반적으로 the inspect command을 사용하여 수행 할 작업을 알 수 있습니다.

관련 문제