Skip to content

Commit 898b87a

Browse files
committed
Update JDK_MANAGEMENT.md to reflect only-script implementation
Fix documentation to accurately describe the shell-based JDK management: ✅ Documentation Updates: - Clarify that JDK management is only available for 'only-script' distribution type - Remove references to removed Java classes (JdkResolver, JdkDownloader, etc.) - Update all Maven plugin examples to include -Dtype=only-script - Explain shell-based implementation architecture - Add distribution type requirement to migration guide ✅ Key Changes: - Replace Java class references with shell script implementation details - Emphasize SDKMAN API integration via curl/wget and PowerShell - Highlight chicken-and-egg problem solution - Update all command examples to be accurate - Add clear migration instructions The documentation now accurately reflects the shell-based implementation and makes it clear that JDK management requires the only-script distribution type.
1 parent 2a9c737 commit 898b87a

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

src/site/markdown/JDK_MANAGEMENT.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
# JDK Management in Maven Wrapper
1919

20-
This document describes the enhanced JDK management capabilities added to Maven Wrapper, allowing projects to automatically download and manage JDK installations.
20+
This document describes the enhanced JDK management capabilities added to Maven Wrapper for the `only-script` distribution type, allowing projects to automatically download and manage JDK installations.
2121

2222
## Overview
2323

24-
The Maven Wrapper now supports:
24+
The Maven Wrapper `only-script` distribution now supports:
2525

2626
- 🚀 **Automatic JDK download and installation**
2727
- 📦 **JDK version management via maven-wrapper.properties**
@@ -31,6 +31,17 @@ The Maven Wrapper now supports:
3131
- ⚙️ **Environment variable configuration**
3232
- ↩️ **Backward compatibility with existing configurations**
3333

34+
## Distribution Type Support
35+
36+
**Important**: JDK management is **only available for the `only-script` distribution type**. This design choice avoids the chicken-and-egg problem where Java is needed to download Java.
37+
38+
```bash
39+
# Generate wrapper with JDK management support
40+
mvn wrapper:wrapper -Dtype=only-script -Djdk=17 -DjdkVendor=temurin
41+
```
42+
43+
The `only-script` distribution uses shell scripts (Unix) and PowerShell (Windows) to handle JDK download and installation directly, without requiring Java to be pre-installed.
44+
3445
## Configuration
3546

3647
### Basic JDK Configuration
@@ -120,20 +131,20 @@ export MAVEN_WRAPPER_TOOLCHAIN_JDK=11
120131

121132
## Maven Plugin Usage
122133

123-
Use the Maven Wrapper plugin to configure JDK settings:
134+
Use the Maven Wrapper plugin to configure JDK settings (requires `only-script` distribution type):
124135

125136
```bash
126-
# Set JDK version via plugin
127-
mvn wrapper:wrapper -Djdk=17
137+
# Set JDK version via plugin (must specify only-script type)
138+
mvn wrapper:wrapper -Dtype=only-script -Djdk=17
128139

129140
# Set JDK vendor
130-
mvn wrapper:wrapper -Djdk=17 -DjdkVendor=corretto
141+
mvn wrapper:wrapper -Dtype=only-script -Djdk=17 -DjdkVendor=corretto
131142

132143
# Set toolchain JDK
133-
mvn wrapper:wrapper -Djdk=17 -DtoolchainJdk=11
144+
mvn wrapper:wrapper -Dtype=only-script -Djdk=17 -DtoolchainJdk=11
134145

135146
# Use direct URL
136-
mvn wrapper:wrapper -DjdkUrl=https://example.com/jdk-17.tar.gz
147+
mvn wrapper:wrapper -Dtype=only-script -DjdkUrl=https://example.com/jdk-17.tar.gz
137148
```
138149

139150
## Toolchains Integration
@@ -210,10 +221,10 @@ EOF
210221

211222
```bash
212223
# Use Amazon Corretto JDK 17
213-
mvn wrapper:wrapper -Djdk=17 -DjdkVendor=corretto
224+
mvn wrapper:wrapper -Dtype=only-script -Djdk=17 -DjdkVendor=corretto
214225

215226
# Use Azul Zulu JDK 21
216-
mvn wrapper:wrapper -Djdk=21 -DjdkVendor=zulu
227+
mvn wrapper:wrapper -Dtype=only-script -Djdk=21 -DjdkVendor=zulu
217228
```
218229

219230
## Security
@@ -262,18 +273,25 @@ The JDK management feature is fully backward compatible. Existing Maven Wrapper
262273

263274
To migrate to automatic JDK management:
264275

265-
1. Add `jdkVersion` to your `maven-wrapper.properties`
266-
2. Optionally specify `jdkVendor` (defaults to Temurin)
267-
3. Remove manual JDK installation steps from your build process
268-
4. Update documentation to reference the new automatic JDK management
276+
1. **Switch to `only-script` distribution type** (required for JDK management)
277+
2. Add `jdkVersion` to your `maven-wrapper.properties`
278+
3. Optionally specify `jdkVendor` (defaults to Temurin)
279+
4. Remove manual JDK installation steps from your build process
280+
5. Update documentation to reference the new automatic JDK management
281+
282+
```bash
283+
# Migration command
284+
mvn wrapper:wrapper -Dtype=only-script -Djdk=17 -DjdkVendor=temurin
285+
```
269286

270287
## Implementation Details
271288

272-
The JDK management feature consists of several components:
289+
The JDK management feature is implemented entirely in shell scripts for the `only-script` distribution type:
273290

274-
- **JdkResolver**: Resolves JDK versions to download URLs
275-
- **JdkDownloader**: Downloads and installs JDKs
276-
- **ToolchainManager**: Manages toolchains.xml integration
277-
- **BinaryDownloader**: Generic binary download and extraction
291+
- **Shell Scripts**: `only-mvnw` (Unix/Linux/macOS) and `only-mvnw.cmd` (Windows)
292+
- **SDKMAN API Integration**: Direct HTTP calls using `curl`/`wget` and PowerShell
293+
- **Version Resolution**: Major version (17) → Latest patch version (17.0.14)
294+
- **Archive Extraction**: Native `tar`/`unzip` commands with cross-platform support
295+
- **Toolchain Integration**: Direct XML manipulation for `~/.m2/toolchains.xml`
278296

279-
These components work together to provide a seamless JDK management experience while maintaining the simplicity and reliability of Maven Wrapper.
297+
This shell-based approach avoids the chicken-and-egg problem of needing Java to download Java, providing a self-contained solution that works without any Java runtime pre-installed.

0 commit comments

Comments
 (0)