我有一个名为MyPlugin
的插件,需要从另一个插件更新值。因此,我将该插件添加为基于的依赖项
Need to provide a SettingKey from a plugin I use in my sbt plugin
但是,sbt无法解决依赖性fm-sbt-s3-resolver
。包括对项目的依赖关系的合适方法是什么?
我尝试将其添加到enablePlugins
的build.sbt的MyPlugin
上,并尝试将其添加到dependencies
上,如下所示:
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-java-sdk-sts" % amazonSDKVersion,
"com.frugalmechanic" % "fm-sbt-s3-resolver" % "0.17.0"
)
在MyPlugin.scala
中:
import fm.sbt.S3ResolverPlugin
object MyPlugin {
override def requires = S3ResolverPlugin
override lazy val globalSettings = Seq(
resolvers += repos
S3ResolverPlugin.autoImport.s3CredentialsProvider := s3CredentialsProviderChain
)
}
我从sbt收到此错误:
我可以在Maven Central Repo的this url上找到该项目。
module not found: com.frugalmechanic#fm-sbt-s3-resolver;0.17.0
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.frugalmechanic/fm-sbt-s3-resolver/0.17.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.frugalmechanic/fm-sbt-s3-resolver/0.17.0/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/localuser/.ivy2/local/com.frugalmechanic/fm-sbt-s3-resolver/0.17.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/frugalmechanic/fm-sbt-s3-resolver/0.17.0/fm-sbt-s3-resolver-0.17.0.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /Users/localuser/.sbt/preloaded/com.frugalmechanic/fm-sbt-s3-resolver/0.17.0/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////Users/localuser/.sbt/preloaded/com/frugalmechanic/fm-sbt-s3-resolver/0.17.0/fm-sbt-s3-resolver-0.17.0.pom
[warn] ==== sonatype-public: tried
[warn] https://oss.sonatype.org/content/repositories/public/com/frugalmechanic/fm-sbt-s3-resolver/0.17.0/fm-sbt-s3-resolver-0.17.0.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.frugalmechanic#fm-sbt-s3-resolver;0.17.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.frugalmechanic:fm-sbt-s3-resolver:0.17.0 (/Users/localuser/lendi/core/scala/lendi-plugin/build.sbt#L13-17)
[warn] +- com.mypackage.my-plugin:0.0.6 (scalaVersion=2.12, sbtVersion=1.0)
[error] sbt.librarymanagement.ResolveException: unresolved dependency: com.frugalmechanic#fm-sbt-s3-resolver;0.17.0: not found
[error] at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:332)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:208)
[error] at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)
[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:238)
[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:45)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:93)
[error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:68)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$19(LibraryManagement.scala:106)
[error] at scala.util.control.Exception$Catch.apply(Exception.scala:224)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:106)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:89)
[error] at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:149)
[error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:120)
[error] at sbt.Classpaths$.$anonfun$updateTask$5(Defaults.scala:2561)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: com.frugalmechanic#fm-sbt-s3-resolver;0.17.0: not found
答案 0 :(得分:2)
查看frugalmechanic group in maven, 似乎存在以下pom:
fm-sbt-s3-resolver_2.12_1.0/0.17.0/fm-sbt-s3-resolver-0.17.0.pom
^^^^^^^^^ this is scala version, and sbt version.
此路径不是普通路径,它由组ID和工件ID软件包版本组成,因为其中包含_2.12_1.0
。这意味着该插件定位于Scala版本2.12
和sbt版本1.0
。
因此,将插件添加为依赖项,您必须使用Defaults.sbtPluginExtra()
并告知您需要特定的scala版本和插件版本,如下所示:
libraryDependencies += Defaults.sbtPluginExtra("com.frugalmechanic" % "fm-sbt-s3-resolver" % "0.17.0", "1.0", "2.12")
第一个参数是package,第二个参数是sbt版本,第三个参数是scala版本。
答案 1 :(得分:0)
您可能需要Case "UsGe"
Application.ScreenUpdating = False
ActiveSheet.Range("F:BC").EntireColumn.Hidden = True
ActiveSheet.Range("G:G,T:T,AG:AG").EntireColumn.Hidden = False
Range("a1").Select
Call HideRangeIfEmpty("G6:AG200")
Private Sub HideRangeIfEmpty(R1)
For Each xRg In Range(R1)
If xRg.Value = "" Then
xRg.EntireRow.Hidden = True
Else
xRg.EntireRow.Hidden = False
End If
Next xRg
End Sub
,所以您不必担心Scala或SBT版本(它将自动处理):
addSbtPlugin
以下是在另一个SBT插件中使用它的示例:built.sbt for fm-sbt-common