2 years ago

#17250

test-img

Rajkumar Natarajan

object stream is not a member of package akka

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?

akka

akka-stream

0 Answers

Your Answer

Accepted video resources