I have scala application, and having pom.xml that uses maven scala plugin, My application uses scala readInt
to read an Integer from the Command Line
The project is build on eclipse, when i run the scala application using eclipse it works
when i try to use scala plugin to run the same application it stucks readInt
mvn scala:run -DmainClass=run.readFromConsole
did i missing anything ?
This is the exception trace
[INFO] Checking for multiple versions of scala
Exception in thread "main" java.io.EOFException: Console has reached end of input
at scala.Console$.readInt(Console.scala:349)
at scala.Predef$.readInt(Predef.scala:296)
at run.readFromConsole$$anonfun$1.apply$mcVI$sp(readFromConsole.scala:6)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141)
at run.readFromConsole$delayedInit$body.apply(readFromConsole.scala:5)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
at scala.App$class.main(App.scala:71)
at run.readFromConsole$.main(readFromConsole.scala:3)
at run.readFromConsole.main(readFromConsole.scala)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.929s
[INFO] Finished at: Thu Apr 03 16:42:20 IST 2014
[INFO] Final Memory: 14M/299M
the code
object readFromConsole extends App {
for (i <- 0 to 4) {
println("Console Input " +i+ " " + readInt )
}
}
The code runs fine with standalone, using scalac,scala or even from eclipse scala application, when i try to run from the mvn scala application it throws the error.
mvn clean compile scala:run -DmainClass=run.readFromConsole