Could not determine the dependencies of task ':spring-oxm:compileTestJava'.

Could not resolve all dependencies for configuration ':spring-oxm:testCompileClasspath'. Failed to calculate the value of task ':spring-core:compileJava21Java' property 'javaCompiler'. > No matching toolchains found for requested specification: {languageVersion=21, vendor=any, implementation=vendor-specific}. > No locally installed toolchains match (see https://docs.gradle.org/8.1.1/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.1.1/userguide/toolchains.html#sub:download_repositories).

Comment From: bclozel

As of 6.1.x, the Spring Frammework build requires a JKD 21 install locally. See https://github.com/spring-projects/spring-framework/wiki/Build-from-Source#before-you-start

I'll repurpose this issue to check whether we can automate that with Gradle.

Comment From: geeklenny

"To build you will need Git and JDK 17 and JDK 21 . Be sure that your JAVA_HOME environment variable points to the jdk17 folder extracted from the JDK download."

I've Installed jdk17 locally.

Comment From: bclozel

It doesn't seem we can auto-provision toolchains for early access versions. We'll revisit this issue when JDK 21 is officially released.

In the meantime, please install a JDK 21 early access version in your environment so it can be detected by Gradle

Comment From: m14ebrskull5

Add org.gradle.java.installations.paths=${JDK21_PATH} in gradle.properties solved this problem

Comment From: h183551

Hi, I am facing the same issue now. I cloned the spring framework repo by doing git clone https://github.com/spring-projects/spring-framework.git I installed JDK17 JAVA_VERSION="17.0.2" And downloaded JDK21 using the link in the build from source webpage And assigned the path of JDK17 to JAVA_HOME And added the path to jdk-21 and jdk21/bin to the environment variable PATH. Then I run gradlew build as explained in the build from source web page.

When I did that I got this error Spring Configure Gradle toolchain auto-provisioning in build

I tried setting auto update and auto download to false and tried setting path property in properties.gradle and tried by adding plugins in settings gradle but the issue persist.

This was done on a Windows machine..

All I wanted is to follow a Spring framework introduction course and wanted to run some code locally. What do I need to do to solve this? The issue as I understand is that gradlew does not detect the JDK21.

Comment From: bclozel

@h183551 have you tried the suggestion from @m14ebrskull5 ?

Also out of curiosity, why would you need to check out the Spring Framework project to learn about Spring? I think that https://spring.io/guides is a much better place.

If you would like to run some code locally, https://start.spring.io should give you what you need. You don't need to compile Spring Framework yourself to use it.

Comment From: h183551

@bclozel Yes I tried. I tried multiple approaches, one of them was the one you refer to. Besides, I found other threads on internet and tried them, for example I tried plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '21' } in settings.gradle

And I tried setting the path only to 21 in the gradle.properties and tried having both jdk17 and 21, and tried the same approach again with disabling auto detect and auto download.

Regarding your question about why I am checking out it, I cloned it to have it locally in my machine when I was following a tutorial on Youtube. I don\t know why there is no already built release online available for downloads. Anyways, I tried the steps in the build from source page in two machines and two virtual machines with no success. I assume there is either something wrong in the steps or missing steps.

I am still looking for help. If you have any regarding building from source.

Comment From: bclozel

I don't know why there is no already built release online available for downloads.

There are. You can get them by starting a project with a build tool like maven or Gradle. Almost nobody in the Spring community builds from source. Artifacts are publicly available on Maven Central.

Comment From: h183551

Does that mean the build from source guide https://github.com/spring-projects/spring-framework/wiki/Build-from-Source is obsolete and not valid anymore?

Comment From: bclozel

No it means that this guide is meant for people who want to contribute code to the project or for some very specific reasons do not want to consume the official binaries.

I'll help you building from source but if your goal is to learn and use Spring, building from source makes a very poor experience.

Comment From: h183551

@bclozel I appreciate if you can help me building from source

Comment From: h183551

@bclozel Now I tried something else and I think it is working now. When I added org.gradle.java.installations.paths=${JDK21_PATH} before I did that in the file located inside buildSrc folder. Now I did that in the file located in the root of the unzipped file (spring-framewkr) and things started working. Thank you

Comment From: bclozel

Ok I thought this was the first thing you tried. I'll adapt the wiki page in the meantime to add this bit of information. Thanks for letting me know.

Comment From: h183551

@bclozel yes it will be better if the wiki is updated. By the way, when I run this gradlew publishToMavenLocal -x api -x javadoc -x dokkaHtmlMultiModule -x asciidoctor -x asciidoctorPdf -x distZip as advised in https://github.com/spring-projects/spring-framework/wiki/Build-from-Source

It failed with FAILURE: Build failed with an exception.

  • What went wrong: Task 'asciidoctor' not found in root project 'spring' and its subprojects.

So what I did is just gradlew publishToMavenLocal And things went OK.

Back to ./gradlew build I get this BUILD SUCCESSFUL in 5m 41s 276 actionable tasks: 92 executed, 74 from cache, 110 up-to-date

A build scan was not published as you have not authenticated with server 'ge.spring.io'. For more information, please see https://gradle.com/help/gradle-authenticating-with-gradle-enterprise.

But in fact, I assumed that when building from source I would get something like this below. It is a tutorial for spring-framework-3.0.5 that I found on youtube created by Java Brains

Spring Configure Gradle toolchain auto-provisioning in build

I am not sure now where the built jars are. Are they created inside respective projects folders?

And one more thing, I would be happy if I am allowed to update the wiki myself so it would be my first humble contribution, and you can review it to make sure it is alright.

Comment From: bclozel

@h183551 I've updated the wiki page. If you want to get all the jars in a single place, the easiest way is to run ./gradlew :framework-docs:distZip and then get them from the distribution zip file located in framework-docs/build/distributions/.

Note that this tutorial is outdated - Spring Framework 3.0.5 has been released in 2010.

Comment From: yokeshwaran1

Hello @bclozel and team, I read the discussion on this issue, I can provide some assistance with configuring the Gradle toolchain auto-provisioning. Before I dive in, I wanted to check if any one is already actively working on this. If not, I will happy to contribute.

Comment From: bclozel

Thanks for the offer @yokeshwaran1 at this stage we are only waiting for JDK21 to be officially released and available for tool chain configuration. I'll mark this issue as blocked for now.