2014-10-10 132 views
1

我有一個Scala/Android項目,我用SBT 0.12.4編譯。有用。爲什麼由於缺少apklib依賴與自定義本地存儲庫而導致構建失敗?

我可以宣佈一個新的存儲庫和新apklib依賴性:

resolvers += "local maven" at "file:./lib/" 
libraryDependencies += apklib("com.sbstrm" % "appirater" % "1.3.1") 

我已經得到了以下文件在我的項目的根./lib/(對應於local maven解析器的定義):

com/sbstrm/appirater

  • _maven.repositories
  • appirater-1.3.1.apklib
  • appirater-1.3.1.pom

com/sbstrm/appirater/1.3.1

  • Maven的元數據local.xml中

會出現一些問題當我升級到0.13.6。

隨着我得到了下面的錯誤,我不能在我的項目再嵌入appirater庫版本:

[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] ::   UNRESOLVED DEPENDENCIES   :: 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] :: com.sbstrm#appirater;1.3.1: URI is not hierarchical 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] 
[warn] Note: Unresolved dependencies path: 
[warn]  com.sbstrm:appirater:1.3.1 (/project/build.sbt#L34-35) 
[warn]  +- default:project_2.11:0.1-SNAPSHOT 
sbt.ResolveException: unresolved dependency: com.sbstrm#appirater;1.3.1: URI is not hierarchical 
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:243) 
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:158) 
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:156) 
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:147) 
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:147) 
    at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:124) 
    at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:56) 
    at sbt.IvySbt$$anon$3.call(Ivy.scala:64) 
    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:64) 
    at sbt.IvySbt.withIvy(Ivy.scala:119) 
    at sbt.IvySbt.withIvy(Ivy.scala:116) 
    at sbt.IvySbt$Module.withModule(Ivy.scala:147) 
    at sbt.IvyActions$.updateEither(IvyActions.scala:156) 
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1282) 
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1279) 
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$84.apply(Defaults.scala:1309) 
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$84.apply(Defaults.scala:1307) 
    at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35) 
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1312) 
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1306) 
    at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45) 
    at sbt.Classpaths$.cachedUpdate(Defaults.scala:1324) 
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1264) 
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1242) 
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) 
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) 
    at sbt.std.Transform$$anon$4.work(System.scala:63) 
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) 
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) 
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) 
    at sbt.Execute.work(Execute.scala:235) 
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) 
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) 
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) 
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) 
    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:695) 
[error] (*:update) sbt.ResolveException: unresolved dependency: com.sbstrm#appirater;1.3.1: URI is not hierarchical 

有沒有人有辦法解決嗎?

+0

'apklib'從哪裏來?它肯定是使用sbt進行Android開發的插件的一部分。哪一個?那就是我尋找答案的地方。 – 2014-10-10 07:00:51

+0

來自這裏的項目mvn安裝:https://github.com/drewjw81/appirater-android – Mikael 2014-10-10 07:11:38

+0

我問'apklib'方法調用將apklib添加到'libraryDependencies'。這可能是[android-plugin](https://github.com/jberkel/android-plugin)插件的東西。 – 2014-10-10 07:24:57

回答

0

tl; dr使用${baseDirectory.value}來引用項目的主目錄,即resolvers += "local maven" at s"file:${baseDirectory.value}/lib"。因爲the preconditions on the parameter do not hold,即"file:./lib/"不符合java.io.File的合同。

可以在斯卡拉REPL檢查出來自己:

new java.io.File(new java.net.URI("file:./lib/")) 

根據上述行,你會面對的錯誤:

scala> new java.io.File(new java.net.URI("file:./lib/")) 
java.lang.IllegalArgumentException: URI is not hierarchical 
    at java.io.File.<init>(File.java:418) 
    ... 43 elided 

的解決方案是使用${baseDirectory.value}完全引用路徑項目主目錄:

resolvers += "local ./lib maven" at s"file:${baseDirectory.value}/lib" 
+0

我會試一試你的答案來驗證它。但是,它與我在本文中使用的語法的更新版本的sbt一起使用。順便說一句,我將文件夾名稱更改爲maven_libs,這的確更好。關於包含的文件夾:它取決於您實際使用的sbt插件,尤其是jni項目。 – Mikael 2014-10-30 13:27:50

相關問題