I am creating a specialized build task in my project that would require user input in STDIN which will let users select which version of hadoop,spark etc libraries will be used to build the application.
so far I have created a that task looks like the below.
lazy val build = SettingKey[Unit]("build", "build the app with all dependencies") in all // all is a project key
build := {
println(s"input hadoop client version")
val hadoop = scala.io.Source.fromInputStream(System.in).bufferedReader().readLine
println(s"input hiveserver jdbc version")
val hiveserver = scala.io.Source.fromInputStream(System.in).bufferedReader().readLine
// bunch of code to customize the build
}
The problem with the above code is that the body of build
task key is run whenever the project is initialized in sbt or whenever reload
task is run. so whenever I open the project in sbt, it hangs waiting for me to enter the version inputs in the standard input. How the task be made such that its body is executed only when the task is run and not when the build is initialized