sbt.librarymanagement.ResolveException:使用sbt插件模块在sbt项目中下载错误

问题描述

我遇到以下问题。我有一个以以下方式描述的多模块项目。

import Build._
import sbt.Keys.scalacoptions

lazy val moduleA =
  module(id = "module-a","module-a")

lazy val moduleB =
  module(id = "module-b","module-b")

lazy val root =
  module(id = "sample-project",directory = ".")
    .aggregate(moduleA,moduleB)

lazy val plugin = Project(id = "plugin",base = file("plugin"))
  .settings(
    sbtPlugin := true,name := "MyPlugin"
  )
  .dependsOn(moduleA)

Build声明以下帮助者的地方

object Build {
  val scala212 = "2.12.11"
  val scala213 = "2.13.3"
  val projectScalaVersion = scala213
  val supportedScalaVersions = List(scala213,scala212)

  val projectVersion = "0.3.5-SNAPSHOT"
  val projectOrganization = "com.example"

  val commonSettings = Seq(
    version := projectVersion,crossScalaVersions := supportedScalaVersions,organization := projectOrganization,scalaVersion := projectScalaVersion,scalacoptions += "-deprecation",scalafmtOnCompile := true
  )

  def module(id: String,directory: String): Project = {
    Project(id = id,base = file(directory))
      .settings(commonSettings: _*)
  }

  implicit class ProjectOps(project: Project) {
    def libraries(modules: ModuleID*): Project = {
      project.settings(libraryDependencies ++= modules)
    }

    def disablePublish: Project = {
      project.settings(publishLocal := {},publishM2 := {},publish := {})
    }
  }
}

我正试图添加一个sbt插件以使用任务公开项目的某些部分。 不幸的是,在编译插件时,出现以下错误

sbt:sample-project> plugin/compile
[info] Updating 
[info] Resolved  dependencies
[warn] 
[warn]  Note: Unresolved dependencies path:
[error] stack trace is suppressed; run last plugin / update for the full output
[error] (plugin / update) sbt.librarymanagement.ResolveException: Error downloading com.example:module-a_2.12:0.3.5-SNAPSHOT
[error]   Not found
[error]   Not found
[error]   not found: https://repo1.maven.org/maven2/com/example/module-a_2.12/0.3.5-SNAPSHOT/module-a_2.12-0.3.5-SNAPSHOT.pom
[error]   not found: /Users/ltrojaNowski/.ivy2/local/com.example/module-a_2.12/0.3.5-SNAPSHOT/ivys/ivy.xml
[error]   not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.example/module-a_2.12/0.3.5-SNAPSHOT/ivys/ivy.xml
[error]   not found: https://repo.typesafe.com/typesafe/ivy-releases/com.example/module-a_2.12/0.3.5-SNAPSHOT/ivys/ivy.xml
[error] Total time: 3 s,completed Aug 26,2020 1:35:20 PM

我不知道为什么会这样。任何帮助或技巧,以解决此问题将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)