play-scala-seed.g8 icon indicating copy to clipboard operation
play-scala-seed.g8 copied to clipboard

Windows 10 java.io.IOException: Unable to delete file: C:\Users

Open gerolf opened this issue 6 years ago • 16 comments

generating a new project with sbt new playframework/play-scala-seed.g8 an error is thrown

java -version java version "1.8.0_172" Java(TM) SE Runtime Environment (build 1.8.0_172-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

play_version [2.6.16]: sbt_version [1.1.6]: scalatestplusplay_version [3.1.2]: [error] java.io.IOException: Unable to delete file: C:\Users\gerol\AppData\Local\Temp\giter8-79767804362487\src\main\g8**.gitignore** [error] at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2400) [error] at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1721) [error] at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1617) [error] at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2391) [error] at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1721) [error] at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1617) [error] at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2391) [error] at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1721) [error] at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1617) [error] at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2391) [error] at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1721)
[error] at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1617)
[error] at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2391)
[error] at giter8.JgitHelper.cleanup(JgitHelper.scala:58)
[error] at giter8.Giter8.run(giter8.scala:46)
[error] at giter8.Giter8.run(giter8.scala:56)
[error] at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:30)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[error] at java.lang.reflect.Method.invoke(Unknown Source)
[error] at sbt.TemplateCommandUtil$.call(TemplateCommandUtil.scala:120)
[error] at sbt.TemplateCommandUtil$.runTemplate(TemplateCommandUtil.scala:96)
[error] at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommandUtil.scala:72)
[error] at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommandUtil.scala:68)
[error] at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
[error] at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
[error] at scala.collection.immutable.List.find(List.scala:86)
[error] at sbt.TemplateCommandUtil$.run(TemplateCommandUtil.scala:68)
[error] at sbt.TemplateCommandUtil$.runTemplate(TemplateCommandUtil.scala:55)
[error] at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommandUtil.scala:25)
[error] at sbt.Command$.$anonfun$applyEffect$4(Command.scala:142)
[error] at sbt.Command$.$anonfun$applyEffect$2(Command.scala:137)
[error] at sbt.Command$.process(Command.scala:181)
[error] at sbt.MainLoop$.processCommand(MainLoop.scala:151)
[error] at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:139)
[error] at sbt.State$$anon$1.runCmd$1(State.scala:246)

Manually removing the file (as the current user that also ran the 'sbt new' command) is no problem. Is the template trying to delete the file while it is still 'in use'?

gerolf avatar Aug 07 '18 08:08 gerolf

I have the same problem but only if I run it via sbt, but if you run g8 directly no error occurs:

g8 playframework/play-scala-seed.g8

herdigiorgi avatar Oct 08 '18 13:10 herdigiorgi

I have the same on sbt

amerywu avatar Oct 21 '18 01:10 amerywu

The same problem. I download Cmder and run sbt new <g8 template> successfully.

ShellPaul avatar Oct 23 '18 12:10 ShellPaul

It throws an error!!!!!!!!

ghost avatar Nov 08 '18 09:11 ghost

Same problem here. Can't get it to work even when running g8 directly.

erikachang avatar Nov 13 '18 14:11 erikachang

Why does this problem arise, and can anyone solve it?

hnjincan avatar Nov 15 '18 10:11 hnjincan

Despite this really noisy error, the command (mostly) succeeds and the app will still build and run.

nastysloper avatar Nov 29 '18 01:11 nastysloper

I try to delete the folder manually, but this error still raise.

DozenCoder avatar Jan 11 '19 15:01 DozenCoder

One of the workarounds is to not use cmd altogether, go to intellij > create new project > select scala > lightbend project > from the list of templates select the appropriate one e.g. scala play seed (be sure to be connected to internet for this step) > there you go Now from cmd navigate to your project directory and run the following magical command sbt run You can browse the app on localhost:9000

thakurarjun247 avatar Jan 13 '19 20:01 thakurarjun247

same issue on cmder, use admin cmd solve it

zhimoe avatar Mar 11 '19 08:03 zhimoe

@xiongdahu thanks! running cmd as Administrator solved the issue.

ujjaldey avatar Sep 11 '19 16:09 ujjaldey

I have the same problem :-(

elbaulp avatar Oct 10 '19 09:10 elbaulp

During installation before final stept close the handle to this .gitignore file using any windows special instrument, for example https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer

Serge-Smirnov avatar Apr 11 '20 13:04 Serge-Smirnov

Even I am facing the same issue. Used admin cmd as well but issue doesn't resolve. Kindly suggest

image

parveen0203 avatar Oct 24 '20 11:10 parveen0203

Works fine on 1.4.0 :)

sake92 avatar Sep 20 '21 13:09 sake92

@parveen0203 what sbt version were you on?

SethTisue avatar Sep 20 '21 15:09 SethTisue

So does this work now when using sbt 1.4+. Can somone confirm?

mkurz avatar Mar 02 '23 20:03 mkurz

Can someone confirm this is now fixed when using sbt 1.4 or newer? Thanks!

mkurz avatar Jul 21 '23 10:07 mkurz

I assume this is fixed in sbt 1.4+, if not please let us know. Closing for now.

mkurz avatar Nov 01 '23 07:11 mkurz