下面是我的 scalatra 项目中的 build.sbt 文件。当大多数依赖项得到解决时,由于 commons-codec 和 jetty 插件,构建失败:
import AssemblyKeys._ // put this at the top of the file
import NativePackagerKeys._
packageArchetype.java_server
assemblySettings
scalariformSettings
organization := "io.swagger"
seq(webSettings :_*)
mainClass in assembly := Some("JettyMain")
name := "scalatra-sample"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.11.2"
scalacOptions += "-language:postfixOps"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
"org.scalatra" %% "scalatra" % "2.3.0.RC3",
"org.scalatra" %% "scalatra-scalate" % "2.3.0.RC3",
"org.scalatra" %% "scalatra-json" % "2.3.0.RC3",
"org.scalatra" %% "scalatra-swagger" % "2.3.0.RC3",
"org.scalatra" %% "scalatra-swagger-ext" % "2.3.0.RC3",
"org.scalatra" %% "scalatra-slf4j" % "2.3.0.RC3",
"org.json4s" %% "json4s-jackson" % "3.2.10",
"org.json4s" %% "json4s-ext" % "3.2.10",
"commons-codec" % "commons-codec" % "1.7",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
//"net.databinder.dispatch" %% "json4s-jackson" % "0.11.2",
"net.databinder.dispatch" %% "dispatch-json4s-jackson" % "0.11.2",
"com.typesafe.akka" %% "akka-actor" % "2.3.6",
"org.eclipse.jetty" % "jetty-server" % "9.2.3.v20140905" % "container;compile;test",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.3.v20140905" % "container;compile;test",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;compile;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
)
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
resolvers += "Sonatype OSS Releases" at "http://oss.sonatype.org/content/repositories/releases/"
ivyXML := <dependencies>
<exclude module="slf4j-log4j12"/>
<exclude module="grizzled-slf4j_2.9.1"/>
<exclude module="jsr311-api" />
</dependencies>
mergeStrategy in assembly <<= (mergeStrategy in assembly) {
(old) => {
case "about.html" => MergeStrategy.discard
case x => old(x)
}
}
net.virtualvoid.sbt.graph.Plugin.graphSettings
当我尝试运行 sbt compile 时,出现以下错误。删除 .ivy 和 .sbt 后重试。仍然没有帮助:
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:125)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:103)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:48)
at sbt.IvySbt$$anon$3.call(Ivy.scala:57)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:57)
at sbt.IvySbt.withIvy(Ivy.scala:98)
at sbt.IvySbt.withIvy(Ivy.scala:94)
at sbt.IvySbt$Module.withModule(Ivy.scala:115)
at sbt.IvyActions$.update(IvyActions.scala:125)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1223)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1221)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1244)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1242)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1246)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1241)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1249)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1214)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1192)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (*:update) sbt.ResolveException: unresolved dependency: org.slf4j#slf4j-api;1.7.7: several problems occurred while resolving dependency: org.slf4j#slf4j-api;1.7.7 {compile=
[compile(*), master(*)], runtime=[runtime(*)]}:
[error] several problems occurred while resolving dependency: org.slf4j#slf4j-parent;1.7.7 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
[error] unresolved dependency: commons-validator#commons-validator;1.4.0: several problems occurred while resolving dependency: commons-validator#commons-validator;1.4.0 {compile=[
compile(*), master(*)], runtime=[runtime(*)]}:
[error] several problems occurred while resolving dependency: org.apache.commons#commons-parent;23 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
[error] unresolved dependency: com.fasterxml.jackson.core#jackson-databind;2.3.1: several problems occurred while resolving dependency: com.fasterxml.jackson.core#jackson-databind;
2.3.1 {compile=[compile(*), master(*)], runtime=[runtime(*)]}:
[error] several problems occurred while resolving dependency: com.fasterxml#oss-parent;12 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
[error] unresolved dependency: commons-codec#commons-codec;1.7: several problems occurred while resolving dependency: commons-codec#commons-codec;1.7 {compile=[default(compile)]}:
[error] several problems occurred while resolving dependency: org.apache.commons#commons-parent;26 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
[error] unresolved dependency: org.eclipse.jetty#jetty-server;9.2.3.v20140905: several problems occurred while resolving dependency: org.eclipse.jetty#jetty-server;9.2.3.v20140905
{container=[default(compile)], compile=[default(compile)], test=[default(compile)]}:
[error] several problems occurred while resolving dependency: org.eclipse.jetty#jetty-project;9.2.3.v20140905 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
[error] unresolved dependency: org.eclipse.jetty#jetty-webapp;9.2.3.v20140905: several problems occurred while resolving dependency: org.eclipse.jetty#jetty-webapp;9.2.3.v20140905
{container=[default(compile)], compile=[default(compile)], test=[default(compile)]}:
[error] several problems occurred while resolving dependency: org.eclipse.jetty#jetty-project;9.2.3.v20140905 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
[error] unresolved dependency: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016: several problems occurred while resolving dependency: org.eclipse.jetty.orbit#javax.servle
t;3.0.0.v201112011016 {container=[default(compile)], compile=[default(compile)], provided=[default(compile)], test=[default(compile)]}:
[error] several problems occurred while resolving dependency: org.eclipse.jetty.orbit#jetty-orbit;1 {}:
[error] URI has an authority component
[error] URI has an authority component
[error] URI has an authority component
此 build.sbt 由 swagger-scalatra 模板自动生成