我正在尝试向我的Scala项目中添加this Java依赖项,但是当我运行sbt时,它说:
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/working@HP022L.corp.umbrella.com/jboss-jaxb-api_2.3_spec-working@HP022L.corp.umbrella.com.pom
[warn] ==== sbt-maven-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/maven-releases/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/working@HP022L.corp.umbrella.com/jboss-jaxb-api_2.3_spec-working@HP022L.corp.umbrella.com.pom
[warn] ==== sbt-maven-snapshots: tried
[warn] https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/working@HP022L.corp.umbrella.com/jboss-jaxb-api_2.3_spec-working@HP022L.corp.umbrella.com.pom
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/org.jboss.spec.javax.xml.bind/jboss-jaxb-api_2.3_spec/working@HP022L.corp.umbrella.com/ivys/ivy.xml
[warn] ==== sbt-ivy-snapshots: tried
[warn] https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.jboss.spec.javax.xml.bind/jboss-jaxb-api_2.3_spec/working@HP022L.corp.umbrella.com/ivys/ivy.xml
[warn] module not found: org.reactivestreams#reactive-streams;working@HP022L.corp.umbrella.com
....
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.jboss.spec.javax.xml.bind#jboss-jaxb-api_2.3_spec;working@HP022L.corp.umbrella.com: not found
[warn] :: org.reactivestreams#reactive-streams;working@HP022L.corp.umbrella.com: not found
[warn] :: javax.validation#validation-api;working@HP022L.corp.umbrella.com: not found
[warn] :: org.jboss.spec.javax.annotation#jboss-annotations-api_1.3_spec;working@HP022L.corp.umbrella.com: not found
[warn] :: javax.activation#activation;working@HP022L.corp.umbrella.com: not found
[warn] :: org.apache.httpcomponents#httpclient;working@HP022L.corp.umbrella.com: not found
[warn] :: commons-io#commons-io;working@HP022L.corp.umbrella.com: not found
[warn] :: net.jcip#jcip-annotations;working@HP022L.corp.umbrella.com: not found
[warn] :: org.jboss.logging#jboss-logging-annotations;working@HP022L.corp.umbrella.com: not found
[warn] :: org.jboss.logging#jboss-logging-processor;working@HP022L.corp.umbrella.com: not found
[warn] :: junit#junit;working@HP022L.corp.umbrella.com: not found
[warn] :: org.glassfish.jaxb#jaxb-runtime;working@HP022L.corp.umbrella.com: not found
[warn] :: com.sun.mail#javax.mail;working@HP022L.corp.umbrella.com: not found
[warn] :: org.apache.james#apache-mime4j;working@HP022L.corp.umbrella.com: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
here是完整的sbt日志。
我不明白为什么版本段是working@HP022L.corp.umbrella.com
而不是版本号。
如果有人能指出正确的方向来解决此错误,我将不胜感激。
这是我的build.sbt:
import Dependencies._
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.umbrella"
ThisBuild / organizationName := "Umbrella"
lazy val root = (project in file("."))
.settings(
name := "custom-mapper",
libraryDependencies ++= Seq(
scalaTest % Test,
"org.keycloak" % "keycloak-core" % "6.0.1",
"org.keycloak" % "keycloak-server-spi" % "6.0.1" % "provided",
"org.keycloak" % "keycloak-server-spi-private" % "6.0.1" % "provided",
"org.jboss.spec.javax.ws.rs" % "jboss-jaxrs-api_2.0_spec" % "1.0.1.Final",
"org.keycloak" % "keycloak-admin-client" % "6.0.1",
"org.keycloak" % "keycloak-services" % "6.0.1" % "provided" // this dependency is failing to resolve
)
)
sbt解析器:
sbt:custom-mapper> show fullResolvers
[info] * Raw(ProjectResolver(inter-project, mapped: ))
[info] * FileRepository(local, Patterns(ivyPatterns=Vector(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)([branch]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=Vector(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)([branch]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false), FileConfiguration(true, None))
[info] * FileRepository(local-preloaded-ivy, Patterns(ivyPatterns=Vector(/home/vulcan/.sbt/preloaded/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=Vector(/home/vulcan/.sbt/preloaded/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false), FileConfiguration(true, None))
[info] * local-preloaded: file:////home/vulcan/.sbt/preloaded/
[info] * public: https://repo1.maven.org/maven2/
[info] * sbt-maven-releases: https://repo.scala-sbt.org/scalasbt/maven-releases/
[info] * sbt-maven-snapshots: https://repo.scala-sbt.org/scalasbt/maven-snapshots/
[info] * URLRepository(typesafe-ivy-releases, Patterns(ivyPatterns=Vector(https://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=Vector(https://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false))
[info] * URLRepository(sbt-ivy-snapshots, Patterns(ivyPatterns=Vector(https://repo.scala-sbt.org/scalasbt/ivy-snapshots/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=Vector(https://repo.scala-sbt.org/scalasbt/ivy-snapshots/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false))
答案 0 :(得分:1)
问题在于传递性依赖关系,解决方案是将依赖关系标记为非传递性,现在项目可以编译。
如sbt docs中所述:
禁用传递性
默认情况下,这些声明会提取所有项目依赖项, 传递地。在某些情况下,您可能会发现依赖项 列出该项目并不是必需的。项目使用 例如,Felix OSGI框架仅明确要求其 主jar进行编译和运行。避免使用获取工件依赖项 intransitive()或notTransitive(),如本例所示:
libraryDependencies += "org.apache.felix" % "org.apache.felix.framework" % "1.8.0" intransitive()