stephansun对《Scala in Action》的笔记(1)

stephansun
stephansun (认真你就输了...)

读过 Scala in Action

Scala in Action
  • 书名: Scala in Action
  • 作者: Nilanjan Raychaudhuri
  • 页数: 419
  • 出版社: Manning Publications
  • 出版年: 2013-4-13
  • 第183页

    6.2.3 Setting up the weKanban project with SBT project/build.properties ``` sbt.properties=0.12.0 # 根据我的环境改为 0.13.2 ``` project/plugins.sbt ``` libraryDependencies <+= sbtVersion.apply {v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.11.1") } ``` build.sbt ``` name := "weKanban" organization := "scalainaction" version := "0.1" scalaVersion := "2.10.0" # 根据我的环境改为 2.10.2 scalacOptions ++= Seq("-unchecked", "-deprecation") libraryDependencies ++= Seq( "org.eclipse.jetty" % "jetty-servlet" % "7.3.0.v20110203" % "container", "org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "test,container", "org.eclipse.jetty" % "jetty-server" % "7.3.0.v20110203" % "container" ) seq(com.github.siasia.WebPlugin.webSettings :_*) ``` 以上是书中的示例代码,照着敲好后,输入sbt,提示错误 ``` stephansun@Stephan-MacBook-Pro:~/Desktop/scala_code/weKanban $ rvm:(ruby-2.1.1@rails4) sbt Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 [info] Loading global plugins from /Users/stephansun/.sbt/0.13/plugins [warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`). [info] Loading project definition from /Users/stephansun/Desktop/scala_code/weKanban/project [warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`). [info] Updating {file:/Users/stephansun/Desktop/scala_code/weKanban/project/}wekanban-build... [info] Resolving com.github.siasia#xsbt-web-plugin_2.10;0.13.2-0.2.11.1 ... [warn] module not found: com.github.siasia#xsbt-web-plugin_2.10;0.13.2-0.2.11.1 [warn] ==== typesafe-ivy-releases: tried [warn] http://repo.typesafe.com/typesafe/ivy-releases/com.github.siasia/xsbt-web-plugin_2.10/0.13.2-0.2.11.1/ivys/ivy.xml [warn] ==== sbt-plugin-releases: tried [warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.github.siasia/xsbt-web-plugin_2.10/0.13.2-0.2.11.1/ivys/ivy.xml [warn] ==== local: tried [warn] /Users/stephansun/.ivy2/local/com.github.siasia/xsbt-web-plugin_2.10/0.13.2-0.2.11.1/ivys/ivy.xml [warn] ==== public: tried [warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.10/0.13.2-0.2.11.1/xsbt-web-plugin_2.10-0.13.2-0.2.11.1.pom [warn] ==== sbt-plugin-releases: tried [warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/com.github.siasia/xsbt-web-plugin_2.10/0.13.2-0.2.11.1/ivys/ivy.xml [info] Resolving org.fusesource.jansi#jansi;1.4 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.github.siasia#xsbt-web-plugin_2.10;0.13.2-0.2.11.1: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: sbt.ResolveException: unresolved dependency: com.github.siasia#xsbt-web-plugin_2.10;0.13.2-0.2.11.1: not found 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:116) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116) at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:104) at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:51) at sbt.IvySbt$$anon$3.call(Ivy.scala:60) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98) at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:81) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102) at xsbt.boot.Using$.withResource(Using.scala:11) at xsbt.boot.Using$.apply(Using.scala:10) at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52) at xsbt.boot.Locks$.apply0(Locks.scala:31) at xsbt.boot.Locks$.apply(Locks.scala:28) at sbt.IvySbt.withDefaultLogger(Ivy.scala:60) at sbt.IvySbt.withIvy(Ivy.scala:101) at sbt.IvySbt.withIvy(Ivy.scala:97) at sbt.IvySbt$Module.withModule(Ivy.scala:116) at sbt.IvyActions$.update(IvyActions.scala:125) at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1170) at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1168) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1191) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1189) at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1193) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1188) at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45) at sbt.Classpaths$.cachedUpdate(Defaults.scala:1196) at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1161) at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1139) 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:744) [error] (*:update) sbt.ResolveException: unresolved dependency: com.github.siasia#xsbt-web-plugin_2.10;0.13.2-0.2.11.1: not found Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? % ``` 参考 https://github.com/earldouglas/xsbt-web-plugin/tree/0.9 修改 project/plugins.sbt ``` addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.9.0") ``` build.sbt ``` name := "weKanban" organization := "scalainaction" version := "0.1" scalaVersion := "2.10.2" scalacOptions ++= Seq("-unchecked", "-deprecation") libraryDependencies ++= Seq( "org.eclipse.jetty" % "jetty-servlet" % "7.3.0.v20110203" % "container", "org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "test,container", "org.eclipse.jetty" % "jetty-server" % "7.3.0.v20110203" % "container" ) seq(webSettings :_*) ``` 这样就好了 ``` stephansun@Stephan-MacBook-Pro:~/Desktop/scala_code/weKanban $ rvm:(ruby-2.1.1@rails4) sbt Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 [info] Loading global plugins from /Users/stephansun/.sbt/0.13/plugins [warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`). [info] Loading project definition from /Users/stephansun/Desktop/scala_code/weKanban/project [warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`). [info] Updating {file:/Users/stephansun/Desktop/scala_code/weKanban/project/}wekanban-build... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. [info] Set current project to weKanban (in build file:/Users/stephansun/Desktop/scala_code/weKanban/) [info] Updating {file:/Users/stephansun/Desktop/scala_code/weKanban/}wekanban... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. > ```` 不明白为什么书上写那么多不正确的东西,还解释很多。 先留在这里,以后补充。

    2014-07-31 11:28:15 回应