我想知道是否有人在尝试运行SBT时遇到java.io.FileNotFoundException
的任何经验。
当我尝试让SBT运行时,我得到以下错误。这在我尝试加载项目定义时输入sbt
后立即发生。
我检查了它说它无法访问的文件,它们肯定在那里,我完全不知道它为什么会这样做。
堆栈跟踪如下:
[debug] Running task... Cancelable: false, check cycles: false
java.io.FileNotFoundException: /home/blah/blah/project/target/streams/$global/compilers/$global/out (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at sbt.std.Streams$$anon$3$$anon$2$$anonfun$text$1.apply(Streams.scala:80)
at sbt.std.Streams$$anon$3$$anon$2$$anonfun$text$1.apply(Streams.scala:80)
at sbt.std.Streams$$anon$3$$anon$2.make(Streams.scala:91)
at sbt.std.Streams$$anon$3$$anon$2.text(Streams.scala:80)
at sbt.std.Streams$$anon$3$$anon$2.log(Streams.scala:85)
at sbt.std.TaskStreams$class.log(Streams.scala:31)
at sbt.std.Streams$$anon$3$$anon$2.log(Streams.scala:69)
at sbt.EvaluateTask$$anonfun$logIncomplete$2.log$1(EvaluateTask.scala:95)
at sbt.EvaluateTask$$anonfun$logIncomplete$2.apply(EvaluateTask.scala:99)
at sbt.EvaluateTask$$anonfun$logIncomplete$2.apply(EvaluateTask.scala:94)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at sbt.EvaluateTask$.logIncomplete(EvaluateTask.scala:94)
at sbt.EvaluateTask$.logIncResult(EvaluateTask.scala:86)
at sbt.EvaluateTask$.run$1(EvaluateTask.scala:149)
at sbt.EvaluateTask$.runTask(EvaluateTask.scala:160)
at sbt.EvaluateTask$$anonfun$apply$1$$anonfun$apply$3.apply(EvaluateTask.scala:84)
at sbt.EvaluateTask$$anonfun$apply$1$$anonfun$apply$3.apply(EvaluateTask.scala:83)
at scala.Option.map(Option.scala:133)
at sbt.EvaluateTask$$anonfun$apply$1.apply(EvaluateTask.scala:83)
at sbt.EvaluateTask$$anonfun$apply$1.apply(EvaluateTask.scala:82)
at sbt.EvaluateTask$.withStreams(EvaluateTask.scala:120)
at sbt.EvaluateTask$.apply(EvaluateTask.scala:82)
at sbt.EvaluateTask$.evalPluginDef(EvaluateTask.scala:69)
at sbt.Load$$anonfun$2.apply(Load.scala:51)
at sbt.Load$$anonfun$2.apply(Load.scala:51)
at sbt.Load$.buildPluginDefinition(Load.scala:496)
at sbt.Load$.buildPlugins(Load.scala:477)
at sbt.Load$.plugins(Load.scala:465)
at sbt.Load$.loadUnitNew(Load.scala:419)
at sbt.Load$.loadUnit(Load.scala:410)
at sbt.Load$$anonfun$13$$anonfun$apply$11.apply(Load.scala:252)
at sbt.Load$$anonfun$13$$anonfun$apply$11.apply(Load.scala:252)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:94)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:93)
at sbt.BuildLoader.apply(BuildLoader.scala:137)
at sbt.Load$.loadAll(Load.scala:307)
at sbt.Load$.loadURI(Load.scala:260)
at sbt.Load$.load(Load.scala:256)
at sbt.Load$.load(Load.scala:247)
at sbt.Load$.apply(Load.scala:124)
at sbt.Load$.defaultLoad(Load.scala:39)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:400)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:394)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:394)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
at sbt.Command$.process(Command.scala:90)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71)
at sbt.State$$anon$2.process(State.scala:170)
at sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71)
at sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.MainLoop$.next(MainLoop.scala:71)
at sbt.MainLoop$.run(MainLoop.scala:64)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:53)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:50)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:50)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:33)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:17)
at sbt.MainLoop$.runLogged(MainLoop.scala:13)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
答案 0 :(得分:6)
(Permission denied)
错误表明您可能正在运行sbt
命令,该用户对您输入sbt
的项目没有权限。
使用chown -R youruser:youruser /path/to/project
更改文件夹权限,它应该修复它。
答案 1 :(得分:1)
问题可能是您以root身份运行sbt并且目标文件夹中的几个目录变为root(因此权限被拒绝问题)。您只需运行sudo rm -rf target/
,然后sbt clean compile
即可重新获得您帐户下的已编译文件。为我工作。
答案 2 :(得分:0)
答案都没有帮助,但是@Priyatham提出了一个好主意:我还删除了project/project
和project/target
文件夹-并且可以正常工作。