Closed ajits089 closed 1 year ago
is the problem reproducible without any external dependencies, in a minimal self-contained build?
I tried to reproduce the issue with having just following in the build.sbt and a source file: build.sbt:
ThisBuild / scalaVersion := "3.1.0"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "example"
lazy val root = (project in file("."))
.settings(
name := "sensor-nws"
)
run / fork := true
source file:
object testObj extends App {
println("submit the name")
val name = scala.io.StdIn.readLine()
println(s"name: $name")
}
result:
$ sbt run
[info] welcome to sbt 1.7.2 (Amazon.com Inc. Java 1.8.0_282)
[info] loading global plugins from /Users/ajitkumar/.sbt/1.0/plugins
[info] loading project definition from /Users/ajitkumar/Downloads/test123/project
[info] loading settings for project root from build.sbt ...
[info] set current project to sensor-nws (in build file:/Users/ajitkumar/Downloads/test123/)
[info] compiling 1 Scala source to /Users/ajitkumar/Downloads/test123/target/scala-3.1.0/classes ...
[info] running (fork) testObj
[info] submit the name
[info] name: null
[success] Total time: 6 s, completed 21 Oct, 2022 5:08:00 PM
Please let me know if you need any other info.
duplicate of https://github.com/sbt/sbt/issues/229 ?
note that connectInput in run := true
is old syntax;
modern syntax would be run / connectInput := true
(just as a small aside, your report was difficult to read because it lacked Markdown code fences to delimit the code. @adpi2 and I have edited your comments to use them — I hope you'll use them in future comments & reports)
The problem gets solved after adding run / connectInput := true
to build.sbt.
Thank you @SethTisue
steps
problem
SBT doesn't take user input as expected!
Removing the run fork results in the hadoop jar missing and adding the fork run will not let take user input.
*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
project: https://github.com/ajits089/sensor-nws stackOverflow: https://stackoverflow.com/questions/74132055/removing-run-fork-true-from-sbt-results-in-runtime-notfound-exception-a
expectation
Errors are misleading
notes