From 63cc27eaf4872adc6a586ef573f14bb020d63263 Mon Sep 17 00:00:00 2001 From: Strokkur24 Date: Wed, 22 Oct 2025 17:23:19 +0200 Subject: [PATCH 1/5] chore(paper/dev): add javaLauncher property documentation for downgrading the active Java version in paperweight-userdev --- .../docs/paper/dev/getting-started/userdev.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/content/docs/paper/dev/getting-started/userdev.md b/src/content/docs/paper/dev/getting-started/userdev.md index 3746b9a0c..963a1f829 100644 --- a/src/content/docs/paper/dev/getting-started/userdev.md +++ b/src/content/docs/paper/dev/getting-started/userdev.md @@ -86,6 +86,23 @@ You should remove any dependency on the Paper API, as the dev bundle includes th ::: +:::note[Running userdev with a newer JDK] + +Sometimes, when using a new JDK, a dev bundle might not support that JDK. If you are +getting an error during the execution of `paperweightUserdevSetup`, you can set +paperweight's java launcher property for paperweight to use a lower Java version. + +You can do this by adding the following files to your `build.gradle.kts`: +```kts +paperweight { + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(21) + } +} +``` + +::: + ## Gradle tasks ### `reobfJar` From 38c92bb1f79e533a5ef21623298be2cab7a79ad3 Mon Sep 17 00:00:00 2001 From: Strokkur24 Date: Wed, 22 Oct 2025 17:36:35 +0200 Subject: [PATCH 2/5] chore: rephrase --- src/content/docs/paper/dev/getting-started/userdev.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/content/docs/paper/dev/getting-started/userdev.md b/src/content/docs/paper/dev/getting-started/userdev.md index 963a1f829..a2570b0a7 100644 --- a/src/content/docs/paper/dev/getting-started/userdev.md +++ b/src/content/docs/paper/dev/getting-started/userdev.md @@ -88,12 +88,11 @@ You should remove any dependency on the Paper API, as the dev bundle includes th :::note[Running userdev with a newer JDK] -Sometimes, when using a new JDK, a dev bundle might not support that JDK. If you are -getting an error during the execution of `paperweightUserdevSetup`, you can set -paperweight's java launcher property for paperweight to use a lower Java version. +A dev bundle might not support the Java version of the JDK your Gradle is configured to use. +If you are getting an error during the execution of `paperweightUserdevSetup`, you can try +setting paperweight's java launcher property to a different Java version. -You can do this by adding the following files to your `build.gradle.kts`: -```kts +```kts title="build.gradle.kts" paperweight { javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(21) From a794a53aba996bded2d351df3f6f364557d35dfb Mon Sep 17 00:00:00 2001 From: Strokkur24 Date: Wed, 22 Oct 2025 17:56:45 +0200 Subject: [PATCH 3/5] chore: another rephrase --- src/content/docs/paper/dev/getting-started/userdev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/paper/dev/getting-started/userdev.md b/src/content/docs/paper/dev/getting-started/userdev.md index a2570b0a7..5c6341a1b 100644 --- a/src/content/docs/paper/dev/getting-started/userdev.md +++ b/src/content/docs/paper/dev/getting-started/userdev.md @@ -88,7 +88,7 @@ You should remove any dependency on the Paper API, as the dev bundle includes th :::note[Running userdev with a newer JDK] -A dev bundle might not support the Java version of the JDK your Gradle is configured to use. +A dev bundle might not support the JDK version Gradle is configured to use. If you are getting an error during the execution of `paperweightUserdevSetup`, you can try setting paperweight's java launcher property to a different Java version. From a160d491b11f368baffd880179318ab42625f7cd Mon Sep 17 00:00:00 2001 From: Strokkur24 Date: Wed, 22 Oct 2025 18:02:01 +0200 Subject: [PATCH 4/5] scorpy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matouš Kučera --- src/content/docs/paper/dev/getting-started/userdev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/paper/dev/getting-started/userdev.md b/src/content/docs/paper/dev/getting-started/userdev.md index 5c6341a1b..71c0a52be 100644 --- a/src/content/docs/paper/dev/getting-started/userdev.md +++ b/src/content/docs/paper/dev/getting-started/userdev.md @@ -90,7 +90,7 @@ You should remove any dependency on the Paper API, as the dev bundle includes th A dev bundle might not support the JDK version Gradle is configured to use. If you are getting an error during the execution of `paperweightUserdevSetup`, you can try -setting paperweight's java launcher property to a different Java version. +setting paperweight's `javaLauncher` property to a different Java version. ```kts title="build.gradle.kts" paperweight { From bedb7894b199676699c925b70581585e1e092b39 Mon Sep 17 00:00:00 2001 From: Strokkur24 Date: Wed, 29 Oct 2025 17:42:40 +0100 Subject: [PATCH 5/5] feat: apply jmp's suggestions --- .../docs/paper/dev/getting-started/userdev.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/content/docs/paper/dev/getting-started/userdev.md b/src/content/docs/paper/dev/getting-started/userdev.md index 71c0a52be..74f6c8063 100644 --- a/src/content/docs/paper/dev/getting-started/userdev.md +++ b/src/content/docs/paper/dev/getting-started/userdev.md @@ -86,20 +86,28 @@ You should remove any dependency on the Paper API, as the dev bundle includes th ::: -:::note[Running userdev with a newer JDK] +:::note[Configuring the Java toolchain for userdev setup] -A dev bundle might not support the JDK version Gradle is configured to use. -If you are getting an error during the execution of `paperweightUserdevSetup`, you can try -setting paperweight's `javaLauncher` property to a different Java version. +A given dev bundle may not always support the Java toolchain Gradle is configured to use +(whether configured explicitly or inherited from the Gradle runtime). +If you are getting an error during the execution of `paperweightUserdevSetup` (especially patch application failures), +you can try setting paperweight's `javaLauncher` property to a different Java version. +For example, with 1.17.1: ```kts title="build.gradle.kts" paperweight { javaLauncher = javaToolchains.launcherFor { - languageVersion = JavaLanguageVersion.of(21) + // Example scenario: + // Paper 1.17.1 was originally built with JDK 16 and the bundle + // has not been updated to work with 21+ (but we want to compile with a 25 toolchain) + languageVersion = JavaLanguageVersion.of(17) } } ``` +Among others, the [multi-project branch of the PaperMC/paperweight-test-plugin](https://github.com/PaperMC/paperweight-test-plugin/tree/multi-project) +makes use of this feature. + ::: ## Gradle tasks