scalameta / sbt-native-image

Plugin to generate native-image binaries with sbt
251 stars 22 forks source link

Add support for Windows and Java 11 #9

Closed olafurpg closed 3 years ago

olafurpg commented 3 years ago

Fixes #8 Fixes #7

olafurpg commented 3 years ago

Getting this error message on Windows

 Error while downloading https://repo1.maven.org/maven2/org/iq80/snappy/snappy/0.4/snappy-0.4.jar: Shutdown in progress, ignoring it
Error while downloading https://repo1.maven.org/maven2/com/github/alexarchambault/case-app_2.12/2.0.0/case-app_2.12-2.0.0.jar: Shutdown in progress, ignoring it
Error while downloading https://repo1.maven.org/maven2/com/github/alexarchambault/case-app-annotations_2.12/2.0.0/case-app-annotations_2.12-2.0.0.jar: Shutdown in progress, ignoring it
Error while downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.10/scala-reflect-2.12.10.jar: Shutdown in progress, ignoring it
[error] java.io.FileNotFoundException: C:\Users\runneradmin\AppData\Local\Coursier\cache\v1\.structure.lock (The process cannot access the file because it is being used by another process)
[error]     at java.io.FileOutputStream.open0(Native Method)
[error]     at java.io.FileOutputStream.open(FileOutputStream.java:270)
[error]     at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
[error]     at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
[error]     at lmcoursier.internal.shaded.coursier.paths.CachePath.withStructureLock(CachePath.java:132)
[error]     at lmcoursier.internal.shaded.coursier.cache.CacheLocks$.withStructureLock(CacheLocks.scala:21)
[error]     at lmcoursier.internal.shaded.coursier.cache.CacheLocks$.withLockOr(CacheLocks.scala:38)
[error]     at lmcoursier.internal.shaded.coursier.cache.FileCache.$anonfun$download$33(FileCache.scala:508)
[error]     at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
[error]     at scala.util.Success.$anonfun$map$1(Try.scala:255)
[error]     at scala.util.Success.map(Try.scala:213)

I'm not sure how to proceed, any help would be appreciated!

olafurpg commented 3 years ago

After ~10 different attempts to get native-image working on Windows I gave up on automatic GraalVM installation. Nothing changes for Linux or macOS users but Windows users will need to pre-install native-image and make it available at $JAVA_HOME\bin\native-image.cmd. I'd love to improve this in the future but for now it's the only way I could get it working.

olafurpg commented 3 years ago

Can somebody with a Windows computer confirm the following auto-generated binary works?

https://github.com/scalameta/sbt-native-image/suites/1162040324/artifacts/16850330

olafurpg commented 3 years ago

Looks like it's possible after all to support automatic installation on Windows \o/ This allows the GitHub Actions workflow configuration to build binaries for Windows+macOS+Linux in a single matrix 😎