Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT throws java.io.FileNotFoundException: (Permission denied) on project folder

Tags:

scala

sbt

I'm wondering whether anyone has any experience with a java.io.FileNotFoundException while trying to run SBT.

When I try to get SBT running I get the error below. This happens right after I enter sbt when it tries to load the project definition.

I checked out the files that it says it can't access and they're definitely there and I'm totally stumped as to why it's doing this.

The stack trace is as follows:

[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)
like image 749
Susanne Peng Avatar asked Feb 05 '14 12:02

Susanne Peng


2 Answers

The (Permission denied) error says that you're probably running the sbt command from a user that doesn't have permission for the project you're entering sbt in.

Change folder permissions with chown -R youruser:youruser /path/to/project and it should fix it.

like image 104
Nimrod007 Avatar answered Nov 09 '22 23:11

Nimrod007


The problem could be that you ran sbt as root and few directories inside target folder became root(hence permission denied issue). You can just run sudo rm -rf target/ and then sbt clean compile to regain those compiled files under your account. Worked for me.

like image 26
Priyatham Avatar answered Nov 10 '22 01:11

Priyatham