Quando provo ad eseguire “exec” in SBT, ottengo “Errore durante l'esecuzione exec: java.lang.ArrayIndexOutOfBoundsException: 0”. Come risolvere?

StackOverflow https://stackoverflow.com/questions/3860800

  •  27-09-2019
  •  | 
  •  

Domanda

Se creo un progetto di SBT, anche un semplice "ciao mondo", in fase di compilazione (con successo) e poi exec, è gettato l'errore folowing. Che cosa può essere la ragione e come risolvere questo problema?


java.lang.ArrayIndexOutOfBoundsException: 0
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
    at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:381)
    at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:130)
    at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:158)
    at sbt.ExecProject$$anonfun$execOut$1.apply(ScalaProject.scala:436)
    at sbt.ExecProject$$anonfun$execOut$1.apply(ScalaProject.scala:435)
    at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
    at sbt.impl.RunTask.doRun$1(RunTask.scala:77)
    at sbt.impl.RunTask.runTask(RunTask.scala:85)
    at sbt.impl.RunTask.run(RunTask.scala:32)
    at sbt.impl.RunTask$.apply(RunTask.scala:17)
    at sbt.impl.RunTask$.apply(RunTask.scala:16)
    at sbt.Project$class.run(Project.scala:98)
    at sbt.Project$class.call(Project.scala:93)
    at sbt.BasicScalaProject.call(DefaultProject.scala:21)
    at sbt.xMain$$anonfun$7.apply(Main.scala:512)
    at sbt.xMain$$anonfun$7.apply(Main.scala:512)
    at sbt.xMain.withAction(Main.scala:541)
    at sbt.xMain.sbt$xMain$$handleAction(Main.scala:512)
    at sbt.xMain.handleCommand(Main.scala:502)
    at sbt.xMain.processAction(Main.scala:441)
    at sbt.xMain.process$1(Main.scala:257)
    at sbt.xMain$Continue$1.apply(Main.scala:132)
    at sbt.xMain.run$1(Main.scala:136)
    at sbt.xMain.processArguments(Main.scala:266)
    at sbt.xMain.startProject(Main.scala:107)
    at sbt.xMain.run(Main.scala:84)
    at sbt.xMain.run0$1(Main.scala:35)
    at sbt.xMain.run(Main.scala:42)
    at xsbt.boot.Launch$.run(Launch.scala:53)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42)
    at xsbt.boot.Launch$.launch(Launch.scala:57)
    at xsbt.boot.Launch$.explicit(Launch.scala:42)
    at xsbt.boot.Launch$.initialized(Launch.scala:38)
    at xsbt.boot.Launch$.parsed(Launch.scala:31)
    at xsbt.boot.Launch$.configured(Launch.scala:21)
    at xsbt.boot.Launch$.apply(Launch.scala:16)
    at xsbt.boot.Launch$.apply(Launch.scala:13)
    at xsbt.boot.Boot$.runImpl(Boot.scala:24)
    at xsbt.boot.Boot$.run(Boot.scala:19)
    at xsbt.boot.Boot$.main(Boot.scala:15)
    at xsbt.boot.Boot.main(Boot.scala)
[info] == exec ==
[error] Error running exec: java.lang.ArrayIndexOutOfBoundsException: 0

È stato utile?

Soluzione

Lo scopo dell'azione generazione exec è quello di eseguire un comando sul guscio sottostante. Come tale deve essere seguita con un comando. EG:

exec killall firefox

Sotto le coperte, SBT chiama java.lang.ProcessBuilder, che genera questa eccezione se i tentativi del chiamante per iniziare, ma non ha fornito alcun parametro.

IndexOutOfBoundsException - If the command is an empty list (has size 0)

Mi sa SBT non deve essere propagando questa eccezione e che questo è un bug. Si dovrebbe ricevere un messaggio di errore.

Forse stavi cercando per l'azione di costruzione eseguire , che richiamerà la classe principale.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top