import Dependencies._
import sbt.Keys.{libraryDependencies, resolvers}
import sbt.Resolver
ThisBuild / scalaVersion := "3.1.0"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "example"
ThisBuild / scalacOptions = Seq("-language:implicitConversions", "-deprecation", "-feature")
val AkkaVersion = "2.6.17"
lazy val root = (project in file("."))
.settings(
name := "sensor-nws",
libraryDependencies = Seq(
"org.scalameta" %% "munit" % "0.7.26" % Test,
excludes(("com.typesafe.akka" %% "akka-stream" % AkkaVersion).cross(CrossVersion.for3Use2_13)),
excludes(("org.apache.spark" %% "spark-core" % "3.2.0").cross(CrossVersion.for3Use2_13)),
excludes(("org.apache.spark" %% "spark-sql" % "3.2.0").cross(CrossVersion.for3Use2_13))),
resolvers = Seq(Resolver.typesafeIvyRepo("releases"),
"Artima Maven Repository" at "https://repo.artima.com/releases",
"spark.jars.repositories" at "https://oss.sonatype.org/content/repositories/releases"
)
)
//netty-all replaces all these excludes
def excludes(m: ModuleID): ModuleID =
m.exclude("io.netty", "netty-common").
exclude("io.netty", "netty-handler").
exclude("io.netty", "netty-transport").
exclude("io.netty", "netty-buffer").
exclude("io.netty", "netty-codec").
exclude("io.netty", "netty-resolver").
exclude("io.netty", "netty-transport-native-epoll").
exclude("io.netty", "netty-transport-native-unix-common").
exclude("javax.xml.bind", "jaxb-api").
exclude("jakarta.xml.bind", "jaxb-api").
exclude("javax.activation", "activation").
exclude("jakarta.annotation", "jakarta.annotation-api").
exclude("javax.annotation", "javax.annotation-api")
run / fork := true
Test / fork := true
*if run / fork := true is removed from sbt then: Caused by: java.io.FileNotFoundException: /Users/ajitkumar/Downloads/flice/sensor-nws/target/bg-jobs/sbt_4be36759/target/135c9252/81ecd14d/hadoop-client-api-3.3.1.jar (No such file or directory)
if not removed the below code results in
println("Enter the directory path")
val dir = scala.io.StdIn.readLine()
print("dir ->", dir)
``
[info] Enter the directory path
[error] Exception in thread "main" java.lang.NullPointerException
CodePudding user response:
The problem gets solved after adding run / connectInput := true
to build.sbt.
more on this: https://github.com/sbt/sbt/issues/229