GoogleContainerTools / jib-extensions

Apache License 2.0
116 stars 35 forks source link

the generated jar file has wrong name xxx-unspecified-runner.jar #70

Open lfarkas opened 3 years ago

lfarkas commented 3 years ago

it seems the quarkus plugin generate wrong filename. ie: xxx-unspecified-runner.jar in stead of xxx-runner.jar what i should have to change to generate good filename?

this is the output of a build:

./gradlew xxx:jib

> Task :xxx:quarkusGenerateCode
preparing quarkus application

> Task :xxx:jib FAILED
Running extension: com.google.cloud.tools.jib.gradle.extension.quarkus.JibQuarkusExtension
Running Quarkus Jib extension

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':xxx:jib'.
> error running extension 'com.google.cloud.tools.jib.gradle.extension.quarkus.JibQuarkusExtension': /home/lfarkas/work/test/java/xxx/build/xxx-runner.jar doesn't exist; did you run the Qaurkus Gradle plugin ('quarkusBuild' task)?

anyway if i rename xxx-unspecified-runner.jar to xxx-runner.jar then the result is working.

chanseokoh commented 3 years ago

It's the Quarkus plugin that generates *-runner.jar. I am not sure if it is a bug in Quarkus that the name contains "unspecified", it is working as intended, or there is a way to control it. I looked into their code, and this code seems to determine the filename, while the "baseName" seems to be set here. But I haven't dug into further. @geoand any idea?

In any case, the Jib Quarkus extension simply uses the filename based on the jar task. If you configure the jar task so that the artifact name becomes xxx-unspecified.jar, I think at least it will work? Not that this is a good workaround.

geoand commented 3 years ago

Hh... I don't see how that could happen TBH.

Is there any quarkus configuration being set?

lfarkas commented 3 years ago

not. this is default everything.

geoand commented 3 years ago

Do you have an example application I can run to see this issue?

lfarkas commented 3 years ago

after further investigation the quarkus jib plugin only use the jar name and rename it. the unspecified refer to the version. and our quarkus project has no version. after we add a version it's works as the jar task and everything working. good to know that the version is a must! same as the mainClass (even if it's bogus). imho it'd be also useful to document it.

chanseokoh commented 3 years ago

There may be something the Jib extension can do to make it work when the version is unspecified. I'll leave this issue open for tracking purposes, so that we may look into it when we have time (low priority).

micheljung commented 3 days ago

For others coming here:

./gradlew build -Dquarkus.application.version=1.0.0

Won't do the job. unspecified comes from Gradle's version property. So instead, you want:

./gradlew build -Pversion=1.0.0