我有一個專案,我將它.m2作為插件本地發布到我的目錄中,稍后我需要將其匯入到不同的 Scala 專案中并使用它。似乎發布步驟已正確執行。build.sbt插件專案的檔案如下所示:
lazy val root = (project in file("."))
.enablePlugins(SbtPlugin)
.settings(
name := "pluginName",
organization := "com.myOrg",
pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" => "1.4.6" // set minimum sbt version
}
}
)
resolvers = "confluent" at "https://packages.confluent.io/maven"
libraryDependencies = Seq(
"io.confluent" % "kafka-schema-registry-client" % "7.0.1"
// some other dependemcies
)
在 sbt shell 中運行compile和publishLocal命令后,我收到下一條訊息:
[info] delivering ivy file to /Users/me/Work/repos/external/pluginName/target/scala-2.12/sbt-1.0/ivy-1.0.0.xml
[info] published pluginName to /Users/me/.ivy2/local/com.myOrg/pluginName/scala_2.12/sbt_1.0/1.0.0/poms/pluginName.pom
[info] published pluginName to /Users/me/.ivy2/local/com.myOrg/pluginName/scala_2.12/sbt_1.0/1.0.0/jars/pluginName.jar
[info] published pluginName to /Users/me/.ivy2/local/com.myOrg/pluginName/scala_2.12/sbt_1.0/1.0.0/srcs/pluginName-sources.jar
[info] published pluginName to /Users/me/.ivy2/local/com.myOrg/pluginName/scala_2.12/sbt_1.0/1.0.0/docs/pluginName-javadoc.jar
[info] published ivy to /Users/me/.ivy2/local/com.myOrg/pluginName/scala_2.12/sbt_1.0/1.0.0/ivys/ivy.xml
[success] Total time: 0 s, completed 3 Jan 2022, 10:07:43
為了在另一個 Scala 專案中匯入/安裝這個插件,我在plugins.sbt檔案中添加了下一行:addSbtPlugin("com.myOrg" % "pluginName" % "1.0.0")
我還添加了libs-release-local和libs-snapshot-local到檔案中的externalResolvers部分buid.sbt。
重新加載并編譯專案后,我收到此錯誤:
[error] (update) sbt.librarymanagement.ResolveException: Error downloading io.confluent:kafka-schema-registry-client:7.0.1
[error] Not found
[error] Not found
[error] not found: https://repo1.maven.org/maven2/io/confluent/kafka-schema-registry-client/7.0.1/kafka-schema-registry-client-7.0.1.pom
[error] not found: /Users/me/.ivy2/local/io.confluent/kafka-schema-registry-client/7.0.1/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/io.confluent/kafka-schema-registry-client/7.0.1/ivys/ivy.xml
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/io.confluent/kafka-schema-registry-client/7.0.1/ivys/ivy.xml
我對 Scala 有點陌生,我不明白我做錯了什么。任何人都可以對這個問題有所了解嗎?
uj5u.com熱心網友回復:
您正在發布到本地 Maven 快取,但 sbt 使用 Ivy。
嘗試洗掉publishTo設定,它應該不需要。只需使用該publishLocal任務發布到您本地的 Ivy 快取即可。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/403044.html
標籤:
