2013-10-29 67 views
2

我對Play和Redis很新,需要一些基本的幫助。我從https://github.com/typesafehub/play-plugins/tree/master/redis下載了redis插件。我認爲最好在編寫我自己的應用程序之前先運行示例應用程序。當我試圖運行示例應用程序,我得到:Redis解決依賴關係問題與播放

mbp-2493:sample john$ play --verbose run 
[info] Loading project definition from /Users/john/Personal/ML/cloudbee/play-plugins-master/redis/sample/project 
[info] Set current project to j (in build file:/Users/john/Personal/ML/cloudbee/play-plugins-master/redis/sample/) 
[info] Updating {file:/Users/john/Personal/ML/cloudbee/play-plugins-master/redis/sample/}j... 
[info] Resolving com.typesafe#play-plugins-redis_2.10;2.2.0 ... 
[warn] module not found: com.typesafe#play-plugins-redis_2.10;2.2.0 
[warn] ==== local: tried 
[warn] /Users/john/Personal/ML/cloudbee/play-2.2.0/repository/local/com.typesafe/play-plugins-redis_2.10/2.2.0/ivys/ivy.xml 
[warn] ==== Maven2 Local: tried 
[warn] file:/Users/john/.m2/repository/com/typesafe/play-plugins-redis_2.10/2.2.0/play-plugins-redis_2.10-2.2.0.pom 
[warn] ==== sonatype-oss-snapshots: tried 
[warn] http://oss.sonatype.org/content/repositories/snapshots/com/typesafe/play-plugins-redis_2.10/2.2.0/play-plugins-redis_2.10-2.2.0.pom 
[warn] ==== public: tried 
[warn] http://repo1.maven.org/maven2/com/typesafe/play-plugins-redis_2.10/2.2.0/play-plugins-redis_2.10-2.2.0.pom 
[warn] ==== Typesafe Releases Repository: tried 
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/play-plugins-redis_2.10/2.2.0/play-plugins-redis_2.10-2.2.0.pom 
[info] Resolving org.fusesource.jansi#jansi;1.4 ... 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] ::   UNRESOLVED DEPENDENCIES   :: 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] :: com.typesafe#play-plugins-redis_2.10;2.2.0: not found 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
sbt.ResolveException: unresolved dependency: com.typesafe#play-plugins-redis_2.10;2.2.0: not found 
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:213) 
    at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122) 
    at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121) 
    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:121) 
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1144) 
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1142) 
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1165) 
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1163) 
    at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35) 
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1167) 
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1162) 
    at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45) 
    at sbt.Classpaths$.cachedUpdate(Defaults.scala:1170) 
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1135) 
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1113) 
    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$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
    at java.lang.Thread.run(Thread.java:680) 
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe#play-plugins-redis_2.10;2.2.0: not found 
[error] Total time: 9 s, completed Oct 28, 2013 5:26:51 PM 

回答

3

嘗試,在項目/ Build.scala:

import sbt._ 
import Keys._ 

object ApplicationBuild extends Build { 

    val appName   = "j" 
    val appVersion  = "1.0-SNAPSHOT" 

    val appDependencies = Seq(
     "com.typesafe" % "play-plugins-redis_2.10" % "2.1.1",//not the recent version, but this one is published 
     "com.typesafe.play" %% "play-cache" % "2.2.0" 
    ) 

    val main = play.Project(appName, appVersion, appDependencies).settings(
     resolvers += "Typesafe Releases" at "http://typesafe.artifactoryonline.com/typesafe", 
     resolvers += "pk11 repo" at "http://pk11-scratch.googlecode.com/svn/trunk" 
    ) 
} 

或者離開構建文件不變並在本地發佈:

git clone https://github.com/typesafehub/play-plugins && \ 
cd play-plugins/redis && \ 
sbt publish-local 

有用來源:

+0

我會改變的答案有點成爲'解析器++ = SEQ(...)'和'使用'%%的'libraryDependencies'(然後刪除'2.10')。 WDYT? –

+0

當前的代碼已經過測試並且工作正常。提問者可以自由使用你的風格。 – Schleichardt

+0

我嘗試將上面的內容添加到plugins.sbt後,它不能解決錯誤。示例代碼中沒有build.sbt文件。 –