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

Gradle Model build failure with Java 21 #45279

Closed
sberyozkin opened this issue Dec 24, 2024 · 8 comments
Closed

Gradle Model build failure with Java 21 #45279

sberyozkin opened this issue Dec 24, 2024 · 8 comments
Labels
area/gradle Gradle kind/question Further information is requested

Comments

@sberyozkin
Copy link
Member

Describe the bug

I keep getting

[INFO] --- impsort:1.12.0:sort (sort-imports) @ quarkus-gradle-model ---
[INFO] Loaded from the build cache, saving 0.287s
[INFO] 
[INFO] --- exec:3.1.0:exec (gradle) @ quarkus-gradle-model ---
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.12/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build 

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':gradle-application-plugin'.
> Could not resolve all dependencies for configuration 'classpath'.
   > Could not resolve project :build-logic.
     Required by:
         project :gradle-application-plugin
      > Failed to calculate the value of task ':build-logic:compileJava' property 'javaCompiler'.
         > Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=any vendor, implementation=vendor-specific} for LINUX on x86_64.
            > No locally installed toolchains match and toolchain download repositories have not been configured.

* Try:
> Learn more about toolchain auto-detection at https://docs.gradle.org/8.12/userguide/toolchains.html#sec:auto_detection.
> Learn more about toolchain repositories at https://docs.gradle.org/8.12/userguide/toolchains.html#sub:download_repositories.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

Java 21

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

Maven version: 3.9.8

Additional information

No response

@sberyozkin sberyozkin added the kind/bug Something isn't working label Dec 24, 2024
@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Dec 24, 2024
Copy link

quarkus-bot bot commented Dec 24, 2024

/cc @glefloch, @quarkusio/devtools

@sberyozkin sberyozkin changed the title Gradle Model build failure ith Java 21 Gradle Model build failure with Java 21 Dec 24, 2024
@Eng-Fouad
Copy link
Contributor

Try adding this to settings.gradle.kts:

plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version("0.9.0") // https://plugins.gradle.org/plugin/org.gradle.toolchains.foojay-resolver-convention
}

@gsmet
Copy link
Member

gsmet commented Dec 26, 2024

You need to have a Java 17 available that is resolvable by the Gradle resolver.

Personally, I now use SDKMAN! to manage my JDKs and it seems fine.

BTW, let's avoid adding the bug label for things that are not really bugs in the software itself.

@gsmet gsmet closed this as not planned Won't fix, can't repro, duplicate, stale Dec 26, 2024
@gsmet gsmet added kind/question Further information is requested and removed kind/bug Something isn't working labels Dec 26, 2024
@sberyozkin
Copy link
Member Author

@gsmet So now, anyone who we ask to contribute and who are at newer JDKs must deal with JDK 17 resolution?
IMHO it is a poor experience, this should be at least documented

@Eng-Fouad
Copy link
Contributor

@gsmet So now, anyone who we ask to contribute and who are at newer JDKs must deal with JDK 17 resolution? IMHO it is a poor experience, this should be at least documented

Foojay Toolchains Plugin is an official Gradle plugin that will download the required JDK locally if it is not available.

@gsmet
Copy link
Member

gsmet commented Dec 26, 2024

Well, feel free to document it if you think it's needed.

Keep in mind Java 17 is our base JDK so I wouldn't say that's surprising you need Java 17 around.

And while @Eng-Fouad 's suggestion might be practical for user applications, I don't think our build should download random JDKs by itself.

@sberyozkin
Copy link
Member Author

@gsmet I was able to build Quarkus with Java 21, without this failure. I have Java17 around, in case I need it, but I didn't not have to use any managers.

@sberyozkin
Copy link
Member Author

sberyozkin commented Dec 26, 2024

@gsmet SDKMan helped, thanks for the hint.

@Eng-Fouad Thanks for trying to help, but indeed, I'll stick with SDKMan :-)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants