sdkvm 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.en.md +123 -99
  2. package/README.md +124 -100
  3. package/dist/index.js +370 -89
  4. package/package.json +3 -2
package/README.en.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  [中文](./README.md) | English
14
14
 
15
- Manage **Java JDKs**, the **Go toolchain**, the **Flutter SDK**, and the **Node.js runtime**.
15
+ Manage **Java JDKs**, the **Go toolchain**, the **Flutter SDK**, the **Node.js runtime**, and **Apache Maven**.
16
16
 
17
17
  </div>
18
18
 
@@ -38,28 +38,29 @@ Manage **Java JDKs**, the **Go toolchain**, the **Flutter SDK**, and the **Node.
38
38
 
39
39
  `sdkvm` is a Node.js CLI that installs, switches, and removes SDKs.
40
40
 
41
- | SDK | Source | Notes |
42
- |---|---|---|
43
- | Java | [Temurin](https://adoptium.net/), [Zulu](https://www.azul.com/downloads/), [Corretto](https://aws.amazon.com/corretto/) | `lts` is currently 8 / 11 / 17 / 21 / 25 |
44
- | Go | [go.dev](https://go.dev/dl/) | All historical stable releases |
45
- | Flutter | Official release manifest | stable / beta; both macOS architectures; Linux / Windows are x64 only |
46
- | Node.js | [nodejs.org/dist](https://nodejs.org/dist) | `lts` (currently 24 Krypton) / `latest` / major line; npm switches with the runtime |
41
+ | SDK | Source | Notes |
42
+ | ------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
43
+ | Java | [Temurin](https://adoptium.net/), [Zulu](https://www.azul.com/downloads/), [Corretto](https://aws.amazon.com/corretto/) | `lts` is currently 8 / 11 / 17 / 21 / 25 |
44
+ | Go | [go.dev](https://go.dev/dl/) | All historical stable releases |
45
+ | Flutter | Official release manifest | stable / beta; both macOS architectures; Linux / Windows are x64 only |
46
+ | Node.js | [nodejs.org/dist](https://nodejs.org/dist) | `lts` (currently 24 Krypton) / `latest` / major line; npm switches with the runtime |
47
+ | Maven | [Maven Central](https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/) | `3` / `3.9` / `latest` pick a stable release; prereleases need an exact version |
47
48
 
48
49
  Behavior:
49
50
 
50
- - Each SDK lives in its own directory. `JAVA_HOME`, `GO_HOME`, `FLUTTER_HOME`, and `NODE_HOME` do not overwrite each other.
51
+ - Each SDK lives in its own directory. `JAVA_HOME`, `GO_HOME`, `FLUTTER_HOME`, `NODE_HOME`, and `MAVEN_HOME` do not overwrite each other.
51
52
  - `use` updates one symlink (a junction on Windows). Installed trees are not moved.
52
- - Download URLs come from official APIs. Go, Flutter, and Node.js require a SHA-256 match. Java vendors are verified when a checksum is available.
53
- - Temurin, Go, Flutter, and Node.js accept a mirror. Checksums still come from the official manifest.
53
+ - Download URLs come from official APIs. Go, Flutter, and Node.js require a SHA-256 match. Maven requires the official SHA-512. Java vendors are verified when a checksum is available.
54
+ - Temurin, Go, Flutter, Node.js, and Maven accept a mirror. Checksums still come from the official manifest.
54
55
  - Adding a language means implementing one vendor module. See [Development](#development).
55
56
 
56
57
  ## Requirements
57
58
 
58
- | Dependency | Version | Notes |
59
- |---|---|---|
60
- | Node.js | >= 18.15 | Required for an npm install. The install script ships an isolated runtime |
61
- | OS | — | macOS (Apple Silicon / Intel), mainstream Linux, Windows 10+ |
62
- | Extractor | built in | `tar` on macOS / Linux. Windows uses bsdtar, then PowerShell `Expand-Archive` |
59
+ | Dependency | Version | Notes |
60
+ | ---------- | -------- | ----------------------------------------------------------------------------- |
61
+ | Node.js | >= 18.15 | Required for an npm install. The install script ships an isolated runtime |
62
+ | OS | — | macOS (Apple Silicon / Intel), mainstream Linux, Windows 10+ |
63
+ | Extractor | built in | `tar` on macOS / Linux. Windows uses bsdtar, then PowerShell `Expand-Archive` |
63
64
 
64
65
  Platform limits:
65
66
 
@@ -97,7 +98,7 @@ Then open a new terminal, or `source` the rc file, and check:
97
98
 
98
99
  ```console
99
100
  $ sdkvm version
100
- 1.0.3
101
+ 1.0.4
101
102
  ```
102
103
 
103
104
  To use a custom data root, **pass `SDKVM_HOME` on the install command itself** (`curl | sh` does not read `~/.zshrc`):
@@ -128,16 +129,16 @@ bun add -g sdkvm
128
129
 
129
130
  ## Upgrade
130
131
 
131
- | Install method | Command | What changes |
132
- |---|---|---|
133
- | Script (recommended) | `sdkvm upgrade` | Replaces `$SDKVM_HOME/cli` only. The runtime and installed SDKs stay |
134
- | npm and friends | `npm update -g sdkvm` | CLI only. pnpm / yarn / bun use their own global update command |
132
+ | Install method | Command | What changes |
133
+ | -------------------- | --------------------- | -------------------------------------------------------------------- |
134
+ | Script (recommended) | `sdkvm upgrade` | Replaces `$SDKVM_HOME/cli` only. The runtime and installed SDKs stay |
135
+ | npm and friends | `npm update -g sdkvm` | CLI only. pnpm / yarn / bun use their own global update command |
135
136
 
136
137
  The data directory is independent of a CLI upgrade. A script install can also be refreshed by running the install script again.
137
138
 
138
139
  ## Quick start
139
140
 
140
- Java accepts bare commands (same as `sdkvm java`). Go, Flutter, and Node use subcommands.
141
+ Java accepts bare commands (same as `sdkvm java`). Go, Flutter, Node, and Maven use subcommands.
141
142
 
142
143
  ```sh
143
144
  # Optional: faster downloads in China (scoped per SDK type)
@@ -145,6 +146,7 @@ sdkvm mirror use nju # Java Temurin
145
146
  sdkvm go mirror use nju
146
147
  sdkvm flutter mirror use nju
147
148
  sdkvm node mirror use nju
149
+ sdkvm maven mirror use aliyun
148
150
  sdkvm nrm use taobao # npm install only; independent of mirror above
149
151
 
150
152
  # Java
@@ -167,6 +169,11 @@ sdkvm node install lts
167
169
  sdkvm node use 24
168
170
  node --version
169
171
 
172
+ # Maven (needs JAVA_HOME)
173
+ sdkvm maven install 3.9
174
+ sdkvm maven use 3.9
175
+ mvn -version
176
+
170
177
  # Inspect and remove
171
178
  sdkvm current
172
179
  sdkvm java install 21 --vendor zulu
@@ -182,22 +189,22 @@ Day-to-day: `install` → `use` → `current` / `ls`. Mirrors and npm registries
182
189
 
183
190
  ## Commands
184
191
 
185
- Java accepts bare commands (`sdkvm install`) or `sdkvm java`. Go, Flutter, and Node.js use `sdkvm go`, `sdkvm flutter`, and `sdkvm node`.
192
+ Java accepts bare commands (`sdkvm install`) or `sdkvm java`. Go, Flutter, Node.js, and Maven use `sdkvm go`, `sdkvm flutter`, `sdkvm node`, and `sdkvm maven`.
186
193
 
187
194
  ### Cheat sheet
188
195
 
189
- | Command | Effect |
190
- |---|---|
191
- | `sdkvm install <version>` | Install Java (same as `sdkvm java install`) |
192
- | `sdkvm use <version>` | Switch the current Java |
193
- | `sdkvm ls` / `sdkvm ls -r` | List installed versions / installable lines |
194
- | `sdkvm current` | Show the current version of every SDK |
195
- | `sdkvm uninstall <version>` | Remove one version |
196
+ | Command | Effect |
197
+ | ------------------------------------------------- | ---------------------------------------------------------------------------------------- |
198
+ | `sdkvm install <version>` | Install Java (same as `sdkvm java install`) |
199
+ | `sdkvm use <version>` | Switch the current Java |
200
+ | `sdkvm ls` / `sdkvm ls -r` | List installed versions / installable lines |
201
+ | `sdkvm current` | Show the current version of every SDK |
202
+ | `sdkvm uninstall <version>` | Remove one version |
196
203
  | `sdkvm mirror ls\|use\|current\|show\|set\|unset` | Manage SDK download mirror sites / URLs (install archives, not the npm package registry) |
197
- | `sdkvm nrm ls\|use\|current\|add\|del\|test` | Manage the user-level npm registry (like nrm) |
198
- | `sdkvm java\|go\|flutter\|node …` | Full command group for that SDK |
199
- | `sdkvm version` | Print the CLI version (same as `sdkvm --version`) |
200
- | `sdkvm upgrade` | Upgrade the CLI. See [Upgrade](#upgrade) |
204
+ | `sdkvm nrm ls\|use\|current\|add\|del\|test` | Manage the user-level npm registry (like nrm) |
205
+ | `sdkvm java\|go\|flutter\|node\|maven …` | Full command group for that SDK |
206
+ | `sdkvm version` | Print the CLI version (same as `sdkvm --version`) |
207
+ | `sdkvm upgrade` | Upgrade the CLI. See [Upgrade](#upgrade) |
201
208
 
202
209
  Version forms:
203
210
 
@@ -206,6 +213,7 @@ sdkvm java install lts | 21 | 21.0.5 | 21.0.5+11 | zulu-21
206
213
  sdkvm go install latest | 1.24 | 1.24.5 | golang-1.24
207
214
  sdkvm flutter install latest | 3.47 | 3.47.5 | 3.49.0-0.1.pre | flutter-3.47
208
215
  sdkvm node install lts | latest | 22 | 22.20.0 | nodejs-22.20.0
216
+ sdkvm maven install latest | 3 | 3.9 | 3.9.9 | 4.0.0-rc-4 | maven-3.9
209
217
  ```
210
218
 
211
219
  ### `sdkvm install <version>`
@@ -221,16 +229,16 @@ sdkvm installed Temurin 21.0.12.1 → ~/.sdkvm/jdks/temurin-21.0.12.1
221
229
  sdkvm switch to it: sdkvm use 21
222
230
  ```
223
231
 
224
- | Option | Meaning |
225
- |---|---|
226
- | `--vendor <id>` | Java: `temurin` (default) / `zulu` / `corretto`. Go is `golang`, Flutter is `flutter`, Node.js is `nodejs` |
227
- | `--force` | Delete and reinstall. The default is to skip a version that is already present |
232
+ | Option | Meaning |
233
+ | --------------- | ---------------------------------------------------------------------------------------------------------- |
234
+ | `--vendor <id>` | Java: `temurin` (default) / `zulu` / `corretto`. Go is `golang`, Flutter is `flutter`, Node.js is `nodejs`, Maven is `maven` |
235
+ | `--force` | Delete and reinstall. The default is to skip a version that is already present |
228
236
 
229
237
  A failed checksum or extract removes the partial directory and the cache. The download timer is 60 seconds without data, not a cap on total time.
230
238
 
231
239
  ### `sdkvm use <version>`
232
240
 
233
- Match an installed version, then update the `current-*` link and `JAVA_HOME` / `GO_HOME` / `FLUTTER_HOME` / `NODE_HOME` / `PATH`.
241
+ Match an installed version, then update the `current-*` link and `JAVA_HOME` / `GO_HOME` / `FLUTTER_HOME` / `NODE_HOME` / `MAVEN_HOME` / `PATH`.
234
242
 
235
243
  ```sh
236
244
  sdkvm use 21
@@ -238,9 +246,10 @@ sdkvm use temurin-21.0.5+11
238
246
  sdkvm go use 1.24.5
239
247
  sdkvm flutter use 3.47.5
240
248
  sdkvm node use 22.20.0
249
+ sdkvm maven use 3.9
241
250
  ```
242
251
 
243
- On macOS / Linux the first `use` appends an init block to the shell rc. Open a new terminal or `source ~/.zshrc`. Later switches only move the link. IDEs need a restart before they see the new variables. See [Switching](#switching).
252
+ On macOS / Linux the first `use` appends an init block to the shell rc. Open a new terminal or `source ~/.zshrc`. Later switches only move the link. IDEs need a restart before they see the new variables. Maven needs a JDK: if `JAVA_HOME` is unset, `use` tells you to run `sdkvm java use` first. See [Switching](#switching).
244
253
 
245
254
  ### `sdkvm ls`
246
255
 
@@ -280,6 +289,8 @@ flutter: flutter-3.47.5
280
289
  FLUTTER_HOME → ~/.sdkvm/flutters/flutter-3.47.5
281
290
  node: nodejs-22.20.0
282
291
  NODE_HOME → ~/.sdkvm/nodes/nodejs-22.20.0
292
+ maven: maven-3.9.9
293
+ MAVEN_HOME → ~/.sdkvm/mavens/maven-3.9.9
283
294
  ```
284
295
 
285
296
  ### `sdkvm uninstall <version>`
@@ -288,7 +299,7 @@ Same syntax as `use`. Uninstalling the current version clears that `current-*` l
288
299
 
289
300
  ### `sdkvm mirror`
290
301
 
291
- Manages **install-archive mirrors** per SDK type (not the npm package registry). Java: `sdkvm mirror`. Others: `sdkvm go|flutter|node mirror`. Scopes do not overlap.
302
+ Manages **install-archive mirrors** per SDK type (not the npm package registry). Java: `sdkvm mirror`. Others: `sdkvm go|flutter|node|maven mirror`. Scopes do not overlap.
292
303
 
293
304
  ```sh
294
305
  sdkvm mirror ls
@@ -297,11 +308,11 @@ sdkvm go mirror use aliyun
297
308
  sdkvm node mirror use official # restore official source for that type
298
309
  ```
299
310
 
300
- | Action | Meaning |
301
- |---|---|
302
- | `ls` / `current` / `show` | List sites and show the current config for this type |
303
- | `use <site>` | Switch to a built-in site (`nju` / `tuna` / `aliyun` / `huawei` / `official`) |
304
- | `set [vendor] <url>` / `unset` | Set or clear a raw URL |
311
+ | Action | Meaning |
312
+ | ------------------------------ | ----------------------------------------------------------------------------- |
313
+ | `ls` / `current` / `show` | List sites and show the current config for this type |
314
+ | `use <site>` | Switch to a built-in site (`nju` / `tuna` / `aliyun` / `huawei` / `official`) |
315
+ | `set [vendor] <url>` / `unset` | Set or clear a raw URL |
305
316
 
306
317
  Coverage and hand-entered URLs: [Mirrors and npm registry](#mirrors-and-npm-registry).
307
318
 
@@ -324,20 +335,21 @@ Built-in names: `npm`, `yarn`, `taobao` (alias `npmmirror`), `tencent`, `cnpm`,
324
335
 
325
336
  `install`, `use`, and `uninstall` share this table. Combinations that are not listed are rejected with a rewrite hint.
326
337
 
327
- | Form | Java | Go | Flutter | Node.js | Example |
328
- |---|---|---|---|---|---|
329
- | `<major>` | Latest patch of that major | — | — | Latest of that major | `21`, `22` |
330
- | `<major.minor>` | — | Latest patch of that minor line | Latest stable patch of that minor line | — | `1.24`, `3.47` |
331
- | `lts` | Latest LTS major | — | — | Latest LTS line (currently 24 Krypton) | `lts` |
332
- | `latest` | — | Newest stable | Newest stable, not beta | Newest Current | `latest` |
333
- | `<full-version>` | Exact or prefix | Exact | Exact, including a prerelease | Exact | `21.0.5+11`, `1.24.5`, `3.49.0-0.1.pre`, `22.20.0` |
334
- | `<vendor>-…` | Pin a distribution | Same | Same | Same | `zulu-21`, `golang-1.24`, `nodejs-22.20.0` |
338
+ | Form | Java | Go | Flutter | Node.js | Maven | Example |
339
+ | ---------------- | -------------------------- | ------------------------------- | -------------------------------------- | -------------------------------------- | ----------------------------- | ------------------------------------------------------------- |
340
+ | `<major>` | Latest patch of that major | — | — | Latest of that major | Latest stable of that major | `21`, `22`, `3` |
341
+ | `<major.minor>` | — | Latest patch of that minor line | Latest stable patch of that minor line | — | Latest stable of that minor | `1.24`, `3.47`, `3.9` |
342
+ | `lts` | Latest LTS major | — | — | Latest LTS line (currently 24 Krypton) | — | `lts` |
343
+ | `latest` | — | Newest stable | Newest stable, not beta | Newest Current | Newest stable, not prerelease | `latest` |
344
+ | `<full-version>` | Exact or prefix | Exact | Exact, including a prerelease | Exact | Exact, including a prerelease | `21.0.5+11`, `1.24.5`, `3.49.0-0.1.pre`, `22.20.0`, `4.0.0-rc-4` |
345
+ | `<vendor>-…` | Pin a distribution | Same | Same | Same | Same | `zulu-21`, `golang-1.24`, `nodejs-22.20.0`, `maven-3.9.9` |
335
346
 
336
347
  Rules:
337
348
 
338
- - `21`, `1.24`, `3.47`, and `22` select the newest installed or installable patch on that line.
339
- - Java `21.0.5` is a prefix and can match `21.0.5+11`. Go, Flutter, and Node.js exact versions match the full string.
349
+ - `21`, `1.24`, `3.47`, `22`, `3`, and `3.9` select the newest installed or installable patch on that line.
350
+ - Java `21.0.5` is a prefix and can match `21.0.5+11`. Go, Flutter, Node.js, and Maven exact versions match the full string.
340
351
  - Flutter `latest` and `3.47` resolve on stable only. A beta needs the full prerelease, for example `3.49.0-0.1.pre`.
352
+ - Maven lists stable `x.y.z` releases from 3.0 upward. `latest`, `3`, and `3.9` skip prereleases; install `4.0.0-rc-4` with the full string. Maven has no `lts` alias.
341
353
  - Java `lts` follows the Adoptium list: 8 / 11 / 17 / 21 / 25. Node.js `lts` is the newest `index.json` entry that carries an LTS codename.
342
354
  - Node.js rejects a two-part version such as `22.20`. Use `22` or `22.20.0`.
343
355
  - Omitting the vendor uses the default distribution. Only Java's default is configurable. See [Config file](#config-file).
@@ -354,10 +366,12 @@ The data root is `~/.sdkvm` (`%USERPROFILE%\.sdkvm` on Windows). `SDKVM_HOME` ov
354
366
  ├── gos/ # Go: golang-1.24.5
355
367
  ├── flutters/ # Flutter: flutter-3.47.5
356
368
  ├── nodes/ # Node.js: nodejs-22.20.0
369
+ ├── mavens/ # Maven: maven-3.9.9
357
370
  ├── current-java # JAVA_HOME link (junction on Windows)
358
371
  ├── current-go
359
372
  ├── current-flutter
360
373
  ├── current-node
374
+ ├── current-maven
361
375
  ├── runtime/ # Script-install Node, isolated from current-node
362
376
  ├── cli/ # Script-install CLI package
363
377
  ├── bin/ # Script-install entrypoint sdkvm (add to PATH)
@@ -366,7 +380,7 @@ The data root is `~/.sdkvm` (`%USERPROFILE%\.sdkvm` on Windows). `SDKVM_HOME` ov
366
380
  └── tmp/ # Extract staging, also removed
367
381
  ```
368
382
 
369
- Unpacked size, roughly: Java 300 MB, Go 250 MB, Node.js 100 MB (bundled npm included), Flutter several GB (the archive itself is about 1–2.2 GB).
383
+ Unpacked size, roughly: Java 300 MB, Go 250 MB, Node.js 100 MB (bundled npm included), Maven about 10 MB, Flutter several GB (the archive itself is about 1–2.2 GB).
370
384
 
371
385
  ### Switching
372
386
 
@@ -392,11 +406,16 @@ case ":$PATH:" in *":$FLUTTER_HOME/bin:"*) ;; *) export PATH="$FLUTTER_HOME/bin:
392
406
  export NODE_HOME="$HOME/.sdkvm/current-node"
393
407
  case ":$PATH:" in *":$NODE_HOME/bin:"*) ;; *) export PATH="$NODE_HOME/bin:$PATH";; esac
394
408
  # <<< sdkvm node init <<<
409
+
410
+ # >>> sdkvm maven init >>>
411
+ export MAVEN_HOME="$HOME/.sdkvm/current-maven"
412
+ case ":$PATH:" in *":$MAVEN_HOME/bin:"*) ;; *) export PATH="$MAVEN_HOME/bin:$PATH";; esac
413
+ # <<< sdkvm maven init <<<
395
414
  ```
396
415
 
397
416
  The variables point at the link. Later `use` calls only retarget that link, and a new terminal reads the new value.
398
417
 
399
- On Windows the four `current-*` entries are junctions. `use` writes user environment variables as `REG_EXPAND_SZ` and keeps `%VAR%` references, which avoids the 1024-character `setx` truncation. PATH gains `%JAVA_HOME%\bin`, `%GO_HOME%\bin`, and `%FLUTTER_HOME%\bin`. The Windows Node.js archive has no `bin/` directory, so its PATH entry is `%NODE_HOME%` itself. Open a new terminal or restart the IDE.
418
+ On Windows the five `current-*` entries are junctions. `use` writes user environment variables as `REG_EXPAND_SZ` and keeps `%VAR%` references, which avoids the 1024-character `setx` truncation. PATH gains `%JAVA_HOME%\bin`, `%GO_HOME%\bin`, `%FLUTTER_HOME%\bin`, and `%MAVEN_HOME%\bin`. The Windows Node.js archive has no `bin/` directory, so its PATH entry is `%NODE_HOME%` itself. Open a new terminal or restart the IDE.
400
419
 
401
420
  ## Configuration
402
421
 
@@ -412,7 +431,8 @@ Path: `~/.sdkvm/config.json`. A corrupt file is renamed to `config.json.bak` and
412
431
  "temurin": "https://mirrors.nju.edu.cn/adoptium",
413
432
  "golang": "https://golang.google.cn/dl",
414
433
  "flutter": "https://mirror.nju.edu.cn/flutter/flutter_infra_release",
415
- "nodejs": "https://mirror.nju.edu.cn/nodejs-release"
434
+ "nodejs": "https://mirror.nju.edu.cn/nodejs-release",
435
+ "maven": "https://maven.aliyun.com/repository/central"
416
436
  },
417
437
  "npmRegistries": {
418
438
  "myprivate": "http://xxx/registry/"
@@ -420,23 +440,23 @@ Path: `~/.sdkvm/config.json`. A corrupt file is renamed to `config.json.bak` and
420
440
  }
421
441
  ```
422
442
 
423
- | Field | Meaning | Default |
424
- |---|---|---|
425
- | `version` | Schema version | `1` |
443
+ | Field | Meaning | Default |
444
+ | --------------- | -------------------------------------------------------- | ----------- |
445
+ | `version` | Schema version | `1` |
426
446
  | `defaultVendor` | Java distribution used when the vendor prefix is omitted | `"temurin"` |
427
- | `mirror` | Vendor id to mirror root URL. Ids are unique across SDKs | `{}` |
428
- | `npmRegistries` | Custom npm registries from `sdkvm nrm add` | `{}` |
447
+ | `mirror` | Vendor id to mirror root URL. Ids are unique across SDKs | `{}` |
448
+ | `npmRegistries` | Custom npm registries from `sdkvm nrm add` | `{}` |
429
449
 
430
450
  ### Environment variables
431
451
 
432
- | Variable | Meaning |
433
- |---|---|
434
- | `SDKVM_HOME` | Data root. Default `~/.sdkvm` |
435
- | `SDKVM_MIRROR` | One-shot mirror. Wins over the config file and is not saved |
436
- | `SDKVM_QUIET` | Non-empty suppresses info and warn logs |
437
- | `SDKVM_NODE_DIST` | Node distribution root used by the install script |
452
+ | Variable | Meaning |
453
+ | -------------------- | ------------------------------------------------------------------ |
454
+ | `SDKVM_HOME` | Data root. Default `~/.sdkvm` |
455
+ | `SDKVM_MIRROR` | One-shot mirror. Wins over the config file and is not saved |
456
+ | `SDKVM_QUIET` | Non-empty suppresses info and warn logs |
457
+ | `SDKVM_NODE_DIST` | Node distribution root used by the install script |
438
458
  | `SDKVM_RELEASE_BASE` | GitHub Release root used by the install script and `sdkvm upgrade` |
439
- | `SDKVM_RUNTIME_NODE` | Node version bundled by the install script. Default `22.20.0` |
459
+ | `SDKVM_RUNTIME_NODE` | Node version bundled by the install script. Default `22.20.0` |
440
460
 
441
461
  Mirror precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official source. See [Mirrors and npm registry](#mirrors-and-npm-registry).
442
462
 
@@ -444,11 +464,11 @@ Mirror precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official source.
444
464
 
445
465
  Two independent features:
446
466
 
447
- | | `sdkvm mirror` | `sdkvm nrm` |
448
- |---|---|---|
449
- | Changes | JDK / Go / Flutter / Node **install archive** URLs | **npm package** registry |
450
- | Affects | `sdkvm … install` | `npm install` |
451
- | Scope | Per SDK type | User-level global |
467
+ | | `sdkvm mirror` | `sdkvm nrm` |
468
+ | ------- | -------------------------------------------------- | ------------------------ |
469
+ | Changes | JDK / Go / Flutter / Node / Maven **install archive** URLs | **npm package** registry |
470
+ | Affects | `sdkvm … install` | `npm install` |
471
+ | Scope | Per SDK type | User-level global |
452
472
 
453
473
  ### SDK install mirrors
454
474
 
@@ -459,15 +479,16 @@ sdkvm mirror use nju
459
479
  sdkvm go mirror use nju
460
480
  sdkvm flutter mirror use nju
461
481
  sdkvm node mirror use nju
482
+ sdkvm maven mirror use aliyun
462
483
  ```
463
484
 
464
- | Site | Java (temurin) | Go | Flutter | Node.js |
465
- |---|---|---|---|---|
466
- | `nju` | ✓ | ✓ | ✓ | ✓ |
467
- | `tuna` | ✓ | — | ✓ | — (incomplete archives; not listed) |
468
- | `aliyun` | — | ✓ | — | ✓ |
469
- | `huawei` | — | — | — | ✓ |
470
- | `official` | Clear this type | Clear this type | Clear this type | Clear this type |
485
+ | Site | Java (temurin) | Go | Flutter | Node.js | Maven |
486
+ | ---------- | --------------- | --------------- | --------------- | ----------------------------------- | --------------- |
487
+ | `nju` | ✓ | ✓ | ✓ | ✓ | — |
488
+ | `tuna` | ✓ | — | ✓ | — (incomplete archives; not listed) | — |
489
+ | `aliyun` | — | ✓ | — | ✓ | ✓ |
490
+ | `huawei` | — | — | — | ✓ | ✓ |
491
+ | `official` | Clear this type | Clear this type | Clear this type | Clear this type | Clear this type |
471
492
 
472
493
  Raw URL or one-shot override:
473
494
 
@@ -476,15 +497,16 @@ sdkvm go mirror set golang https://golang.google.cn/dl
476
497
  SDKVM_MIRROR=https://golang.google.cn/dl sdkvm go install 1.24
477
498
  ```
478
499
 
479
- Precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official. A mirror replaces the archive URL only; metadata and checksums still come from the official API. If a mirrored download cannot fetch the official checksum source, install **fails hard**.
500
+ Precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official. A mirror replaces the archive URL only; metadata and checksums prefer the official API. If that checksum URL is unreachable and the checksum is a sidecar of the archive (Maven `.sha512`, Temurin `.json`), install fetches the same sidecar from the mirror and still checks the hash. Install fails when both URLs are unreachable, or when the hash does not match.
480
501
 
481
- | Vendor | Notes |
482
- |---|---|
483
- | Temurin | Adoptium layout; verified against [NJU](https://mirrors.nju.edu.cn/adoptium) and [TUNA](https://mirrors.tuna.tsinghua.edu.cn/Adoptium) |
484
- | Go | File name appended to the root; e.g. `nju` / `aliyun` |
485
- | Flutter | Bucket-prefix replacement; verified against [NJU](https://mirror.nju.edu.cn/flutter/flutter_infra_release). Do not use `storage.flutter-io.cn` |
486
- | Node.js | Prefix replacement; verified against [NJU](https://mirror.nju.edu.cn/nodejs-release). Do not use TUNA nodejs-release |
487
- | Zulu, Corretto | Official CDN only; no mirror support yet |
502
+ | Vendor | Notes |
503
+ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
504
+ | Temurin | Adoptium layout; verified against [NJU](https://mirrors.nju.edu.cn/adoptium) and [TUNA](https://mirrors.tuna.tsinghua.edu.cn/Adoptium) |
505
+ | Go | File name appended to the root; e.g. `nju` / `aliyun` |
506
+ | Flutter | Bucket-prefix replacement; verified against [NJU](https://mirror.nju.edu.cn/flutter/flutter_infra_release). Do not use `storage.flutter-io.cn` |
507
+ | Node.js | Prefix replacement; verified against [NJU](https://mirror.nju.edu.cn/nodejs-release). Do not use TUNA nodejs-release |
508
+ | Maven | Central path prefix replacement; verified against [Aliyun central](https://maven.aliyun.com/repository/central) and [Huawei maven](https://repo.huaweicloud.com/repository/maven). Checksums are the official `.sha512` |
509
+ | Zulu, Corretto | Official CDN only; no mirror support yet |
488
510
 
489
511
  ### npm registry
490
512
 
@@ -496,8 +518,8 @@ sdkvm nrm test # latency
496
518
 
497
519
  ## Security
498
520
 
499
- - URLs are resolved from official APIs: Adoptium, Azul Metadata, Corretto, go.dev/dl, Flutter releases, and nodejs.org/dist `index.json`. Search pages are not scraped.
500
- - Archives are hashed with SHA-256 as they download. Go, Flutter, and Node.js (official `SHASUMS256.txt`) abort on mismatch. If a Java checksum source is unreachable: official downloads warn and continue; **mirrored downloads fail hard** so an unverifiable mirror package is never accepted.
521
+ - URLs are resolved from official APIs: Adoptium, Azul Metadata, Corretto, go.dev/dl, Flutter releases, nodejs.org/dist `index.json`, and Maven Central `maven-metadata.xml`. Search pages are not scraped.
522
+ - Archives are hashed with SHA-256 as they download. Go, Flutter, and Node.js (official `SHASUMS256.txt`) abort on mismatch. Maven hashes the file again with SHA-512 and checks the `.sha512` sidecar (Central does not publish `.sha256`). If a checksum source is unreachable: an official download warns and continues; a mirrored download tries the official sidecar, then the same file on the mirror. Install fails when both are unreachable, or when the hash does not match.
501
523
  - After extract, the tree must have a single root and the expected executable. Extraction always targets a fresh empty directory.
502
524
  - Install and `sdkvm upgrade` hold `~/.sdkvm/.lock` so concurrent writers do not overwrite each other.
503
525
 
@@ -520,7 +542,8 @@ set -gx JAVA_HOME $HOME/.sdkvm/current-java
520
542
  set -gx GO_HOME $HOME/.sdkvm/current-go
521
543
  set -gx FLUTTER_HOME $HOME/.sdkvm/current-flutter
522
544
  set -gx NODE_HOME $HOME/.sdkvm/current-node
523
- fish_add_path $JAVA_HOME/bin $GO_HOME/bin $FLUTTER_HOME/bin $NODE_HOME/bin
545
+ set -gx MAVEN_HOME $HOME/.sdkvm/current-maven
546
+ fish_add_path $JAVA_HOME/bin $GO_HOME/bin $FLUTTER_HOME/bin $NODE_HOME/bin $MAVEN_HOME/bin
524
547
  ```
525
548
 
526
549
  ### Flutter downloads are slow or they stop
@@ -565,17 +588,18 @@ rm -rf ~/.sdkvm/bin ~/.sdkvm/cli ~/.sdkvm/runtime
565
588
 
566
589
  On Windows, delete `%USERPROFILE%\.sdkvm\bin\sdkvm.cmd`, plus `%USERPROFILE%\.sdkvm\cli` and `%USERPROFILE%\.sdkvm\runtime`, and remove `%USERPROFILE%\.sdkvm\bin` from the user PATH.
567
590
 
568
- After you no longer need the installed JDKs, Go, Flutter, and Node.js, remove the data directory:
591
+ After you no longer need the installed JDKs, Go, Flutter, Node.js, and Maven, remove the data directory:
569
592
 
570
593
  ```sh
571
594
  rm -rf ~/.sdkvm
572
595
  ```
573
596
 
574
597
  Also delete these shell blocks:
598
+
575
599
  - `# >>> sdkvm path >>>` … `# <<< sdkvm path <<<`
576
- - each SDK’s `>>> sdkvm java|go|flutter|node init >>>` … `<<< … <<<`
600
+ - each SDK’s `>>> sdkvm java|go|flutter|node|maven init >>>` … `<<< … <<<`
577
601
 
578
- On Windows, remove `JAVA_HOME`, `GO_HOME`, `FLUTTER_HOME`, and `NODE_HOME` from the user environment, and remove `%JAVA_HOME%\bin`, `%GO_HOME%\bin`, `%FLUTTER_HOME%\bin`, and `%NODE_HOME%` from the user PATH.
602
+ On Windows, remove `JAVA_HOME`, `GO_HOME`, `FLUTTER_HOME`, `NODE_HOME`, and `MAVEN_HOME` from the user environment, and remove `%JAVA_HOME%\bin`, `%GO_HOME%\bin`, `%FLUTTER_HOME%\bin`, `%NODE_HOME%`, and `%MAVEN_HOME%\bin` from the user PATH.
579
603
 
580
604
  ## Development
581
605
 
@@ -593,8 +617,8 @@ npm run build
593
617
  src/
594
618
  ├── cli/ # install / use / ls / uninstall / mirror / nrm / upgrade
595
619
  ├── core/ # version parsing, registry, config, file lock
596
- ├── sdk/ # java / go / flutter / node: directories, env vars, version syntax
597
- ├── vendor/ # temurin / zulu / corretto / golang / flutter / nodejs, plus mirror rewrite
620
+ ├── sdk/ # java / go / flutter / node / maven: directories, env vars, version syntax
621
+ ├── vendor/ # temurin / zulu / corretto / golang / flutter / nodejs / maven, plus mirror rewrite
598
622
  ├── fs/ # extract, layout normalize, links
599
623
  ├── shell/ # rc writes, Windows registry
600
624
  ├── net/ # fetch, streaming download, checksums
@@ -605,4 +629,4 @@ To add a language, implement `listMajors` and `resolve` under `src/vendor/`, add
605
629
 
606
630
  ## License
607
631
 
608
- [MIT](./LICENSE) © QINJIN
632
+ [MIT](./LICENSE) © qinlaoshi