我最近将我的第一个Scala&Scala.js交叉构建库发布到了Sonatype。现在,我想在我的一个应用程序中使用Scala.js库,但是如果我想使用以下方式向我的库添加依赖项:
libraryDependencies += "com.github.fbaierl" %%% "scala-tarjan" % "0.1.1"
(这里是库:https://search.maven.org/artifact/com.github.fbaierl/scala-tarjan_sjs0.6_2.12/0.1.1/jar)
我总是会遇到此未解决的依赖错误:
[info] Updating ...
[warn] module not found: com.jsuereth#sbt-pgp;1.1.1
[warn] ==== local: tried
[warn] C:\Users\BAIERLF\.ivy2\local\com.jsuereth\sbt-pgp\scala_2.12\sbt_1.0\1.1.1\ivys\ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/jsuereth/sbt-pgp_2.12_1.0/1.1.1/sbt-pgp-1.1.1.pom
[warn] ==== local-preloaded-ivy: tried
[warn] C:\Users\BAIERLF\.sbt\preloaded\com.jsuereth\sbt-pgp\1.1.1\ivys\ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:/C:/Users/BAIERLF/.sbt/preloaded/com/jsuereth/sbt-pgp_2.12_1.0/1.1.1/sbt-pgp-1.1.1.pom
[warn] ==== Artima Maven Repository: tried
[warn] http://repo.artima.com/releases/com/jsuereth/sbt-pgp_2.12_1.0/1.1.1/sbt-pgp-1.1.1.pom
[warn] ==== jcenter: tried
[warn] https://jcenter.bintray.com/com/jsuereth/sbt-pgp_2.12_1.0/1.1.1/sbt-pgp-1.1.1.pom
[info] downloading https://repo1.maven.org/maven2/com/github/fbaierl/scala-tarjan_2.12/0.1.1/scala-tarjan_2.12-0.1.1.jar ...
[info] [SUCCESSFUL ] com.github.fbaierl#scala-tarjan_2.12;0.1.1!scala-tarjan_2.12.jar (460ms)
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.jsuereth#sbt-pgp;1.1.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.jsuereth:sbt-pgp:1.1.1 (scalaVersion=2.12, sbtVersion=1.0)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.jsuereth:sbt-pgp:1.1.1 (scalaVersion=2.12, sbtVersion=1.0)
[warn] +- com.github.fbaierl:scala-tarjan_2.12:0.1.1 (C:\Users\BAIERLF\Documents\...\build.sbt#L23-24)
[warn] +- xxx:xxx_sjs0.6_2.12:0.1.0-SNAPSHOT
[error] sbt.librarymanagement.ResolveException: unresolved dependency: com.jsuereth#sbt-pgp;1.1.1: not found
[error] at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:334)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:208)
[error] at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:243)
[error] at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:199)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:196)
[error] at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:242)
[error] at sbt.internal.librarymanagement.IvyActions$.updateEither(IvyActions.scala:193)
[error] at sbt.librarymanagement.ivy.IvyDependencyResolution.update(IvyDependencyResolution.scala:20)
[error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:56)
[error] at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:46)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:99)
[error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:68)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$19(LibraryManagement.scala:112)
[error] at scala.util.control.Exception$Catch.apply(Exception.scala:224)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:112)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:95)
[error] at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:149)
[error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:126)
[error] at sbt.Classpaths$.$anonfun$updateTask$5(Defaults.scala:2385)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(Unknown Source)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[error] at java.util.concurrent.FutureTask.run(Unknown Source)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[error] at java.lang.Thread.run(Unknown Source)
[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: com.jsuereth#sbt-pgp;1.1.1: not found
[error] Total time: 5 s, completed 05.11.2018 11:01:32
对于为什么com.jsuereth#sbt-pgp;1.1.1
首先被视为依赖项,我感到非常困惑,但是它也包含在maven模式XML中:
<dependency>
<groupId>com.jsuereth</groupId>
<artifactId>sbt-pgp</artifactId>
<version>1.1.1</version>
</dependency>
据我所知,我从未添加此依赖性,只是使用了this sbt插件(请参阅:here)。
这是我的build.sbt:https://github.com/fbaierl/scalajs-cross-compile-tarjan/blob/d4153b98d8be42f2751eae0f057bea284882c24f/build.sbt
编辑:
在我的addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
上添加以下行:project/plugins.sbt
而不是在~/.sbt/1.0/plugins/gpg.sbt
中全局安装,可能是一个问题吗? (但是我看到其他项目也做同样的事情,所以我不认为这是问题所在吗?)
编辑2:
dependencyTree
给了我以下依存关系:
sbt:scalajs-cross-compile-tarjan> dependencyTree
[info] Updating ProjectRef(uri("file:/home/florian/Documents/scalajs-cross-compile-tarjan/"), "tarjanJVM")...
[info] Updating ProjectRef(uri("file:/home/florian/Documents/scalajs-cross-compile-tarjan/"), "root")...
[info] Updating ProjectRef(uri("file:/home/florian/Documents/scalajs-cross-compile-tarjan/"), "tarjanJS")...
[info] Done updating.
[info] com.github.fbaierl:scala-tarjan_2.12:0.1.1 [S]
[info] +-org.scalactic:scalactic_2.12:3.0.5 [S]
[info] +-org.scala-lang:scala-reflect:2.12.4 [S]
[info]
[info] Done updating.
[info] com.github.fbaierl:scala-tarjan_sjs0.6_2.12:0.1.1 [S]
[info] +-org.scala-js:scalajs-library_2.12:0.6.22 [S]
[info] +-org.scalactic:scalactic_2.12:3.0.5 [S]
[info] +-org.scala-lang:scala-reflect:2.12.4 [S]
[info]
[info] Done updating.
[info] scalajs-cross-compile-tarjan:scalajs-cross-compile-tarjan_2.12:0.1.0-SNAPSHOT [S]