1

I've below build.sbt file -

ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "2.13.7"

val akkaVersion = "2.6.18"

lazy val root = (project in file("."))
  .settings(
    name := "akka-sbt-multijvm-issue"
  )

libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
 "com.typesafe.akka" %% "akka-cluster" % akkaVersion)

I've below main code -

package com.example

object MaterializerApp  extends App {

  import akka.stream.Materializer
}

when I compile the code I get the below error -

sbt clean compile

[info] welcome to sbt 1.6.1 (Azul Systems, Inc. Java 11.0.12)

[info] loading global plugins from /Users/rajkumar.natarajan/.sbt/1.0/plugins

[info] loading settings for project akka-sbt-multijvm-issue-build from plugins.sbt ... [info] loading project definition from /Users/rajkumar.natarajan/Documents/Coding/akka-sbt-multijvm-issue/project [info] loading settings for project root from build.sbt ...

[info] set current project to akka-sbt-multijvm-issue (in build file:/Users/rajkumar.natarajan/Documents/Coding/akka-sbt-multijvm-issue/)

[info] Executing in batch mode. For better performance use sbt's shell [success] Total time: 0 s, completed Jan 5, 2022, 9:13:16 PM [info] compiling 1 Scala source to /Users/rajkumar.natarajan/Documents/Coding/akka-sbt-multijvm-issue/target/scala-2.13/classes ...

[error] /Users/rajkumar.natarajan/Documents/Coding/akka-sbt-multijvm-issue/src/main/scala/com/example/MaterializerApp.scala:5:15: object stream is not a member of package akka [error] import akka.stream.Materializer

                   ^

[error] one error found

[error] (Compile / compileIncremental) Compilation failed

[error] Total time: 4 s, completed Jan 5, 2022, 9:13:21 PM

Note: When I change the akkaVersion to 2.6.17, the compilation succeeds.

How can I fix this error?

user51
  • 8,843
  • 21
  • 79
  • 158
  • In akka 2.6.x the materializer import is not needed anymore, see https://stackoverflow.com/questions/58768399/akka-stream-2-6-how-to-create-actormaterializer/58768480 - So this is enough: `implicit val system: ActorSystem = ActorSystem()` `import system.dispatcher` – earthling paul Jan 06 '22 at 14:55
  • 1
    This compiles just fine for me... (the only clear difference I see is that I'm using the Oracle jdk11, but the Azul one - but it seems hard to believe that could be the difference. – Arnout Engelen Jan 13 '22 at 15:43

0 Answers0