简体   繁体   English

为什么由于缺少自定义本地存储库的apklib依赖关系而导致构建失败?

[英]Why does build fail due to missing apklib dependency with custom local repository?

I have a Scala/Android project that I compile with SBT 0.12.4. 我有一个使用SBT 0.12.4编译的Scala / Android项目。 It works. 有用。

I can declare a new repository and new apklib dependency: 我可以声明一个新的存储库和新的apklib依赖项:

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

I've got the following files in ./lib/ of my project's root (that corresponds to the local maven resolver's definition): 我在项目根目录的./lib/中有以下文件(与local maven解析器的定义相对应):

Under com/sbstrm/appirater com/sbstrm/appirater

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

and in com/sbstrm/appirater/1.3.1 : 并在com/sbstrm/appirater/1.3.1

  • maven-metadata-local.xml 行家-元数据那个local.xml

The issues come when I upgrade sbt to 0.13.6. 当我将sbt升级到0.13.6时,问题就来了。

With the version I'm getting the following errors and I can't embed the appirater library anymore in my project: 使用该版本时,出现以下错误,并且无法在我的项目中嵌入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

Does anyone have a solution? 有没有人有办法解决吗?

tl;dr Use ${baseDirectory.value} to reference the project's main directory, ie resolvers += "local maven" at s"file:${baseDirectory.value}/lib" . tl; dr使用${baseDirectory.value}引用项目的主目录,即resolvers += "local maven" at s"file:${baseDirectory.value}/lib"

The issue comes from the line resolvers += "local maven" at "file:./lib/" because the preconditions on the parameter do not hold , ie "file:./lib/" doesn't meet java.io.File 's contract. 问题来自resolvers += "local maven" at "file:./lib/"的行resolvers += "local maven" at "file:./lib/"因为参数的前提条件不成立 ,即"file:./lib/"不符合java.io.File的合同。

You can check it out yourself in Scala REPL: 您可以在Scala REPL中自己检查一下:

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

With the above line you'll face the error: 在上面的行中,您将遇到错误:

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

The solution is to use ${baseDirectory.value} to fully reference the path of the main directory of the project: 解决方案是使用${baseDirectory.value}来完全引用项目主目录的路径:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有本地代码apklib依赖关系的apklib中缺少架构(android-maven-plugin) - Missing architectures in apklib with native code apklib dependency (android-maven-plugin) Gradle构建无法从自定义maven存储库获取依赖关系 - Gradle build failing to get dependency from custom maven repository 为什么 android 构建失败并显示错误 - Why does android build fail and show error 为什么我的ConstraintLayout链无法建立? - Why does my ConstraintLayout chain fail to build? 为什么Python无法运行ant build? - Why does Python fail to run ant build? 为什么将 Xamarin Android.csproj 加载到 Microsoft.Build.Evaluation.Project 中会由于 missing.targets 文件而抛出 InvalidPropectFileException? - Why does loading a Xamarin Android .csproj into a Microsoft.Build.Evaluation.Project throw InvalidPropectFileException due to missing .targets file? 为什么Butterknife @Bind在发布版本中失败(在proguard之后) - Why does Butterknife @Bind fail in release build (after proguard) 在Gradle构建中声明本地存储库 - declare local repository in gradle build Espresso测试失败的原因是“与依赖项冲突” - Espresso test fail's to build with “Conflict with dependency” APK不会安装在Maven Repo中 - APKLIB does not get installed in Maven Repo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM