0

I'm new to Lagom and SBT and I'm trying to execute my first project using IntelliJ.

The structure of my project is:

enter image description here

My SBT version is:

sbt.version = 0.13.16

The plugins.sbt file contains:

// 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")

And the build.sbt file contains:

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`)

The problem is when I tried to build the project I got this error:

sbt.ResolveException: unresolved dependency: com.lightbend.lagom#lagom-javadsl-api_2.10;1.3.10: not found

[error] (user-api/*:update) sbt.ResolveException: unresolved dependency: com.lightbend.lagom#lagom-javadsl-api_2.10;1.3.10: not found

I also had some warnings like:

[info] Done updating.

[warn] Found version conflict(s) in librarydependencies; some are suspected to be binary incompatible:

[warn] * org.jboss.logging:jboss-logging:3.3.0.Final is selected over 3.2.1.Final

[warn] +- com.lightbend.lagom:lagom-javadsl-api_2.11:1.3.10 (depends on 3.2.1.Final)

[warn] +- org.hibernate:hibernate-validator:5.2.4.Final
(depends on 3.2.1.Final)

[warn] * io.netty:netty-codec-http:4.0.51.Final is selected over 4.0.41.Final

[warn] +- com.lightbend.lagom:lagom-service-locator_2.11:1.3.10 (depends on 4.0.51.Final)

[warn] +- com.lightbend.lagom:lagom-client_2.11:1.3.10
(depends on 4.0.51.Final)

[warn] +- org.asynchttpclient:async-http-client:2.0.36
(depends on 4.0.51.Final)

[warn] +- com.typesafe.netty:netty-reactive-streams-http:1.0.8 (depends on 4.0.41.Final)

I can't undresting why sbt can't find lagom-javadsl-api dependency. Did I miss something ?

Thanks for helping.

Community
  • 1
  • 1
Imen
  • 161
  • 2
  • 14

1 Answers1

1

You need to set:

scalaVersion in ThisBuild := "2.11.12"

This ensures that it gets set for the entire build, rather than just being set for the root project. If it's just set for the root project, then you get the default Scala version, which for sbt 0.13 is 2.10. Also, Lagom 1.3 is not cross built against Scala 2.12, so you have to use 2.11.

James Roper
  • 12,695
  • 46
  • 45
  • Thank you, I changed the Scala version, it seems that he found the dependency but I got another error " Could not find a suitable constructor in com.lightbend.lagom.internal.javadsl.server.ResolvedServices. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private." and the warnings are still there. Do you know why? please – Imen Dec 07 '17 at 09:32
  • I resolved the second error by exposing my module in the configuration file. @James thank you for your Help – Imen Dec 07 '17 at 16:17