Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Quarkus-cli create app doesn't auto-detect Host java version #24613

Closed
pjgg opened this issue Mar 29, 2022 · 11 comments · Fixed by #24645
Closed

Regression: Quarkus-cli create app doesn't auto-detect Host java version #24613

pjgg opened this issue Mar 29, 2022 · 11 comments · Fixed by #24645
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Milestone

Comments

@pjgg
Copy link
Contributor

pjgg commented Mar 29, 2022

Describe the bug

When you create an app with Quarkus-cli 2.6.3 the tool detects the java version that is running in the developer environment and the resulted app has the same java version as the host.

This feature is broken in Quarkus 2.7.5.Final

Reproducer:

Quarkus 2.6.3

Install quarkus-cli 2.6.3: jbang app install --name qs2.6.3 io.quarkus:quarkus-cli:2.6.3.Final:runner
Create app: qs2.6.3 create app app

The pom has the same Java version as the host machine.

Quarkus 2.7.5

Install quarkus-cli 2.6.3: jbang app install --name qs2.7.5 io.quarkus:quarkus-cli:2.7.5.Final:runner
Create app: qs2.7.5 create app app
Pom Java version:<maven.compiler.release>11</maven.compiler.release>
Expected version: 17

Output of java -version

openjdk 17.0.1 2021-10-19 OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12) OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)

@pjgg pjgg added the kind/bug Something isn't working label Mar 29, 2022
@quarkus-bot quarkus-bot bot added area/cli Related to quarkus cli (not maven/gradle/etc.) area/jbang Issues related to when using jbang.dev with Quarkus labels Mar 29, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 29, 2022

/cc @ebullient, @maxandersen, @quarkusio/devtools

@maxandersen
Copy link
Contributor

okey thats weird but I can confirm it does not seem to work :/

@ebullient @ia3andy any ideas ?

@ebullient
Copy link
Contributor

I think it is the match for the java version property...
we fall back to the default if it didn't match. So we're making a bad assumption about what a version string looks like (I haven't stared at the regex and I don't think I wrote it, but that's where the problem lies, I believe.. so if you have that version string handy, we can figure it out)

@gsmet
Copy link
Member

gsmet commented Mar 30, 2022

Given we are targeting Java 11+ now, can't we use Runtime.version().feature() instead?
Maybe we need to check that GraalVM returns the underlying Java version and not the GraalVM version but I think it should probably work (and avoid things being brittle).

@gsmet
Copy link
Member

gsmet commented Mar 30, 2022

Another possibility would be to use java.specification.version but if Runtime.version().feature() works OK, it's probably the way to go.

@ebullient
Copy link
Contributor

perhaps? yes. This is what needs to be revised:

public static void setJavaVersion(Map<String, Object> values, String javaTarget) {

I won't be able to get there today.

@gsmet
Copy link
Member

gsmet commented Mar 30, 2022

I will have a look. I need simple stuff today.

@maxandersen
Copy link
Contributor

"java.version" is 17 on my local version so not sure why that code would fail to detect 17...

@gsmet
Copy link
Member

gsmet commented Mar 30, 2022

As I said, I looked into and already have a patch ready. I’m running the Maven tests locally and will create a PR later today.

@gsmet
Copy link
Member

gsmet commented Mar 30, 2022

And yes the main problem is not the detection but the CLI itself.

Anyway I’m out for a while, will open the PR when I’m back.

@gsmet gsmet changed the title Regresion: Quarkus-cli create app doesn't auto-detect Host java version Regression: Quarkus-cli create app doesn't auto-detect Host java version Mar 30, 2022
gsmet added a commit to gsmet/quarkus that referenced this issue Mar 30, 2022
Also, make sure project created with Java 18 will use Java 17 and not
Java 11.
Finally, use autodetection for QuarkusJBangCodestartProjectInputBuilder
too.

Fixes quarkusio#24613
@gsmet
Copy link
Member

gsmet commented Mar 30, 2022

@pjgg any chance you could check #24645 fixes the problem for you?

@quarkus-bot quarkus-bot bot added this to the 2.9 - main milestone Mar 31, 2022
@gsmet gsmet modified the milestones: 2.9 - main, 2.8.1.Final Apr 11, 2022
gsmet added a commit to gsmet/quarkus that referenced this issue Apr 11, 2022
Also, make sure project created with Java 18 will use Java 17 and not
Java 11.
Finally, use autodetection for QuarkusJBangCodestartProjectInputBuilder
too.

Fixes quarkusio#24613

(cherry picked from commit be33427)
@gsmet gsmet modified the milestones: 2.8.1.Final, 2.7.6.Final May 12, 2022
gsmet added a commit to gsmet/quarkus that referenced this issue May 12, 2022
Also, make sure project created with Java 18 will use Java 17 and not
Java 11.
Finally, use autodetection for QuarkusJBangCodestartProjectInputBuilder
too.

Fixes quarkusio#24613

(cherry picked from commit be33427)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants