Quarkus: Gradle Jar/main directory issues, 1.7.1.FInal

Created on 29 Aug 2020  路  16Comments  路  Source: quarkusio/quarkus

Just updated to the latest (1.7.1.Final) quarkus, and the tests run fine, but when running quarkusDev I get the following output, and no running server:

> Task :WebServer:Server:quarkusDev
Listening for transport dt_socket at address: 5005
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.io.UncheckedIOException: Error while reading file as JAR: /home/gstewart/GitRepos/task-timekeeper/WebServer/WebLibrary/build/resources/main
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:150)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.io.UncheckedIOException: Error while reading file as JAR: /home/gstewart/GitRepos/task-timekeeper/WebServer/WebLibrary/build/resources/main
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:135)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:85)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:144)
        ... 1 more
Caused by: java.lang.RuntimeException: java.io.UncheckedIOException: Error while reading file as JAR: /home/gstewart/GitRepos/task-timekeeper/WebServer/WebLibrary/build/resources/main
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:374)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:51)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:132)
        ... 3 more
Caused by: java.io.UncheckedIOException: Error while reading file as JAR: /home/gstewart/GitRepos/task-timekeeper/WebServer/WebLibrary/build/resources/main
        at io.quarkus.bootstrap.classloading.JarClassPathElement.<init>(JarClassPathElement.java:46)
        at io.quarkus.bootstrap.classloading.ClassPathElement.fromPath(ClassPathElement.java:51)
        at io.quarkus.bootstrap.app.CuratedApplication.createDeploymentClassLoader(CuratedApplication.java:265)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:330)
        ... 5 more
Caused by: java.io.FileNotFoundException: /home/gstewart/GitRepos/task-timekeeper/WebServer/WebLibrary/build/resources/main (No such file or directory)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:225)
        at java.util.zip.ZipFile.<init>(ZipFile.java:155)
        at java.util.jar.JarFile.<init>(JarFile.java:166)
        at java.util.jar.JarFile.<init>(JarFile.java:130)
        at io.smallrye.common.io.jar.JarFiles.create(JarFiles.java:34)
        at io.quarkus.bootstrap.classloading.JarClassPathElement.<init>(JarClassPathElement.java:44)
        ... 8 more
<============-> 98% EXECUTING [48s]
> :WebServer:Server:quarkusDev

Runs fine on 1.6.1.Final. Let me know what else would be good to put here as far as output.

aregradle kinbug

Most helpful comment

I can also see this in 1.8.3 in a multi module gradle project. It seems that an _existing_ but _empty_ src/main/resources directory is not materialized to build/resources/main, leading to this exception.

My current work around is to define at least one file within src/main/resources in every submodule of the project. Hope this might help in the meantime.

All 16 comments

/cc @quarkusio/devtools, @glefloch

@GregJohnStewart do you have a small reproducer?

@glefloch I also experienced this - it seems to occur when there is a submodule with an empty resources folder.

Here's a repro:

https://github.com/acgray/quarkus-issue-11725

(An empty folder can't be committed so you will have to run mkdir common/src/main/resources then gradle build)

I've also experienced this on gradle multi project 馃憤 Reproducer was kindly provided above, but if its not enough I can provide one as well later.

@Meemaw can you push your project? I tried @acgray project and I'm not able to reproduce the issue.
I tried running ./gradlew :webserver:quarkusDev and accessing localhost:8080/hello works.

@glefloch did you create the empty common/src/main/resources directory before running quarkusDev?

@acgray right, after creating the empty folder, I can see the error

still existing... in version 1.7.3.Final

Still getting this in 1.8.1.Final too

@acgray is the same reproducer you provided above failing? Thanks.

@acgray please create a new issue to track it. Thanks.

I can also see this in 1.8.3 in a multi module gradle project. It seems that an _existing_ but _empty_ src/main/resources directory is not materialized to build/resources/main, leading to this exception.

My current work around is to define at least one file within src/main/resources in every submodule of the project. Hope this might help in the meantime.

Is there an open issue the mentioned workaround is avoiding? If not, somebody please open one with a reproducer, if you want it to be fixed sooner. Thanks!

Here is a reproducer for this issue: https://github.com/huw0/quarkus-11725-reproducer

  • Without any src/main/resources the error does not occur
  • Therefore it is necessary to create the empty folder src/main/resources. If this was committed with a .gitkeep then the folder is no longer empty so the error does not occur.

Stacktrace is identical to the original post.

Thanks @huw0 #13087 fixes your reproducer.

Was this page helpful?
0 / 5 - 0 ratings