【问题标题】:lagom-javadsl-api not found in SBT project在 SBT 项目中找不到 lagom-javadsl-api
【发布时间】:2018-05-21 07:15:37
【问题描述】:

我是 Lagom 和 SBT 的新手,我正在尝试使用 IntelliJ 执行我的第一个项目。

我的项目结构是:

我的 SBT 版本是:

sbt.version = 0.13.16

plugins.sbt 文件包含:

// The Lagom plugin
addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.3.10")
// Needed for importing the project into Eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")

而 build.sbt 文件包含:

name := "testsbt"

version := "1.0-SNAPSHOT"

scalaVersion := "2.12.3"

lazy val `hello-lagom` = (project in file("."))
  .aggregate(`user-api`, `user-impl`)

lazy val `user-api` = (project in file("user-api"))
  .settings(
    libraryDependencies += lagomJavadslApi
  )

lazy val `user-impl` = (project in file("user-impl"))
  .enablePlugins(LagomJava)
  .dependsOn(`user-api`)

问题是当我尝试构建项目时出现此错误:

sbt.ResolveException:未解决的依赖: com.lightbend.lagom#lagom-javadsl-api_2.10;1.3.10:未找到

[错误] (user-api/*:update) sbt.ResolveException: 未解决的依赖: com.lightbend.lagom#lagom-javadsl-api_2.10;1.3.10:未找到

我也收到了一些警告,例如:

[信息] 完成更新。

[警告] 在库依赖项中发现版本冲突;有些怀疑是二进制不兼容的:

[warn] * org.jboss.logging:jboss-logging:3.3.0.Final 被选中 3.2.1.决赛

[警告] +- com.lightbend.lagom:lagom-javadsl-api_2.11:1.3.10 (取决于 3.2.1.Final)

[警告] +- org.hibernate:hibernate-validator:5.2.4.Final
(取决于 3.2.1.Final)

[warn] * io.netty:netty-codec-http:4.0.51.Final 被选中 4.0.41.决赛

[警告] +- com.lightbend.lagom:lagom-service-locator_2.11:1.3.10 (取决于 4.0.51.Final)

[警告] +- com.lightbend.lagom:lagom-client_2.11:1.3.10
(取决于 4.0.51.Final)

[警告] +- org.asynchttpclient:async-http-client:2.0.36
(取决于 4.0.51.Final)

[警告] +- com.typesafe.netty:netty-reactive-streams-http:1.0.8 (取决于 4.0.41.Final)

我无法解释为什么 sbt 找不到 lagom-javadsl-api 依赖项。我错过了什么吗?

感谢您的帮助。

【问题讨论】:

    标签: java intellij-idea sbt lagom


    【解决方案1】:

    你需要设置:

    scalaVersion in ThisBuild := "2.11.12"
    

    这可确保为整个构建设置它,而不仅仅是为根项目设置。如果它只是为根项目设置,那么你会得到默认的 Scala 版本,对于 sbt 0.13 是2.10。此外,Lagom 1.3 不是针对 Scala 2.12 交叉构建的,因此您必须使用 2.11。

    【讨论】:

    • 谢谢,我改了Scala版本,好像找到了依赖但是又报错“Could not find a suitable constructor in com.lightbend.lagom.internal.javadsl.server.ResolvedServices . 类必须有一个(并且只有一个)用@Inject 注释的构造函数或一个非私有的零参数构造函数。”警告仍然存在。你知道为什么吗?请
    • 我通过在配置文件中公开我的模块解决了第二个错误。 @James 感谢您的帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-15
    • 1970-01-01
    • 2017-10-18
    • 2018-07-16
    • 2017-03-25
    相关资源
    最近更新 更多