sdkvm 1.0.2 → 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.
- package/README.en.md +153 -122
- package/README.md +154 -123
- package/dist/index.js +385 -89
- 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**,
|
|
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
|
|
42
|
-
|
|
43
|
-
| Java
|
|
44
|
-
| Go
|
|
45
|
-
| Flutter | Official release manifest
|
|
46
|
-
| Node.js | [nodejs.org/dist](https://nodejs.org/dist)
|
|
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 `
|
|
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,
|
|
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
|
|
59
|
-
|
|
60
|
-
| Node.js
|
|
61
|
-
| OS
|
|
62
|
-
| Extractor
|
|
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
|
|
|
@@ -69,22 +70,11 @@ Platform limits:
|
|
|
69
70
|
|
|
70
71
|
## Install
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
**Prefer the install script**: no preinstalled Node.js, an isolated runtime for the CLI, data and entrypoint under `SDKVM_HOME` (default `~/.sdkvm`), and upgrades via `sdkvm upgrade`.
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
### Install script (recommended)
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
npm install -g sdkvm
|
|
78
|
-
pnpm add -g sdkvm
|
|
79
|
-
yarn global add sdkvm
|
|
80
|
-
bun add -g sdkvm
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
The CLI then runs on whatever `node` is first on `PATH`. Switching to a Node older than 18.15 stops the CLI until you switch back.
|
|
84
|
-
|
|
85
|
-
### Install script
|
|
86
|
-
|
|
87
|
-
No preinstalled Node.js is required. A GitHub Release that already contains `sdkvm.tgz` and `SHA256SUMS` is required (uploaded by CI after a `v*` tag).
|
|
77
|
+
Requires a [GitHub Release](https://github.com/QInJ1995/sdkvm/releases) that already contains `sdkvm.tgz` and `SHA256SUMS` (uploaded by CI after a `v*` tag).
|
|
88
78
|
|
|
89
79
|
macOS / Linux:
|
|
90
80
|
|
|
@@ -100,37 +90,55 @@ irm https://raw.githubusercontent.com/QInJ1995/sdkvm/main/install.ps1 | iex
|
|
|
100
90
|
|
|
101
91
|
The script:
|
|
102
92
|
|
|
103
|
-
1. Downloads Node.js 22.20.0 into
|
|
104
|
-
2. Downloads `sdkvm.tgz` from the GitHub Release, checks SHA-256, and extracts it to
|
|
105
|
-
3. Writes
|
|
93
|
+
1. Downloads Node.js 22.20.0 into `$SDKVM_HOME/runtime` (CLI only; `sdkvm node use` does not change it).
|
|
94
|
+
2. Downloads `sdkvm.tgz` from the GitHub Release, checks SHA-256, and extracts it to `$SDKVM_HOME/cli`.
|
|
95
|
+
3. Writes `$SDKVM_HOME/bin/sdkvm` (on Windows, `%SDKVM_HOME%\bin\sdkvm.cmd`) and adds that directory to the shell profile / user PATH (zsh → `~/.zshrc`, bash → `~/.bash_profile` or `~/.bashrc`).
|
|
106
96
|
|
|
107
|
-
|
|
97
|
+
Then open a new terminal, or `source` the rc file, and check:
|
|
98
|
+
|
|
99
|
+
```console
|
|
100
|
+
$ sdkvm version
|
|
101
|
+
1.0.4
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
To use a custom data root, **pass `SDKVM_HOME` on the install command itself** (`curl | sh` does not read `~/.zshrc`):
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
SDKVM_HOME=/Volumes/Develop/sdkvm \
|
|
108
|
+
curl -fsSL https://raw.githubusercontent.com/QInJ1995/sdkvm/main/install.sh | sh
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Override download prefixes when needed:
|
|
108
112
|
|
|
109
113
|
```sh
|
|
110
114
|
SDKVM_NODE_DIST=https://npmmirror.com/mirrors/node \
|
|
111
115
|
SDKVM_RELEASE_BASE=https://github.com/QInJ1995/sdkvm/releases \
|
|
112
|
-
|
|
116
|
+
curl -fsSL https://raw.githubusercontent.com/QInJ1995/sdkvm/main/install.sh | sh
|
|
113
117
|
```
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
### npm / pnpm / yarn / bun (alternative)
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
Use this when Node.js >= 18.15 is already installed and you want the package manager to own global tools. The CLI follows the `node` on `PATH`; a Node older than 18.15 can stop the CLI.
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
npm install -g sdkvm
|
|
125
|
+
pnpm add -g sdkvm
|
|
126
|
+
yarn global add sdkvm
|
|
127
|
+
bun add -g sdkvm
|
|
120
128
|
```
|
|
121
129
|
|
|
122
130
|
## Upgrade
|
|
123
131
|
|
|
124
|
-
| Install method
|
|
125
|
-
|
|
126
|
-
|
|
|
127
|
-
|
|
|
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 |
|
|
128
136
|
|
|
129
|
-
|
|
137
|
+
The data directory is independent of a CLI upgrade. A script install can also be refreshed by running the install script again.
|
|
130
138
|
|
|
131
139
|
## Quick start
|
|
132
140
|
|
|
133
|
-
Java accepts bare commands (same as `sdkvm java`). Go, Flutter, and
|
|
141
|
+
Java accepts bare commands (same as `sdkvm java`). Go, Flutter, Node, and Maven use subcommands.
|
|
134
142
|
|
|
135
143
|
```sh
|
|
136
144
|
# Optional: faster downloads in China (scoped per SDK type)
|
|
@@ -138,6 +146,7 @@ sdkvm mirror use nju # Java Temurin
|
|
|
138
146
|
sdkvm go mirror use nju
|
|
139
147
|
sdkvm flutter mirror use nju
|
|
140
148
|
sdkvm node mirror use nju
|
|
149
|
+
sdkvm maven mirror use aliyun
|
|
141
150
|
sdkvm nrm use taobao # npm install only; independent of mirror above
|
|
142
151
|
|
|
143
152
|
# Java
|
|
@@ -160,6 +169,11 @@ sdkvm node install lts
|
|
|
160
169
|
sdkvm node use 24
|
|
161
170
|
node --version
|
|
162
171
|
|
|
172
|
+
# Maven (needs JAVA_HOME)
|
|
173
|
+
sdkvm maven install 3.9
|
|
174
|
+
sdkvm maven use 3.9
|
|
175
|
+
mvn -version
|
|
176
|
+
|
|
163
177
|
# Inspect and remove
|
|
164
178
|
sdkvm current
|
|
165
179
|
sdkvm java install 21 --vendor zulu
|
|
@@ -175,22 +189,22 @@ Day-to-day: `install` → `use` → `current` / `ls`. Mirrors and npm registries
|
|
|
175
189
|
|
|
176
190
|
## Commands
|
|
177
191
|
|
|
178
|
-
Java accepts bare commands (`sdkvm install`) or `sdkvm java`. Go, Flutter,
|
|
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`.
|
|
179
193
|
|
|
180
194
|
### Cheat sheet
|
|
181
195
|
|
|
182
|
-
| Command
|
|
183
|
-
|
|
184
|
-
| `sdkvm install <version>`
|
|
185
|
-
| `sdkvm use <version>`
|
|
186
|
-
| `sdkvm ls` / `sdkvm ls -r`
|
|
187
|
-
| `sdkvm current`
|
|
188
|
-
| `sdkvm uninstall <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 |
|
|
189
203
|
| `sdkvm mirror ls\|use\|current\|show\|set\|unset` | Manage SDK download mirror sites / URLs (install archives, not the npm package registry) |
|
|
190
|
-
| `sdkvm nrm ls\|use\|current\|add\|del\|test`
|
|
191
|
-
| `sdkvm java\|go\|flutter\|node …`
|
|
192
|
-
| `sdkvm version`
|
|
193
|
-
| `sdkvm 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) |
|
|
194
208
|
|
|
195
209
|
Version forms:
|
|
196
210
|
|
|
@@ -199,6 +213,7 @@ sdkvm java install lts | 21 | 21.0.5 | 21.0.5+11 | zulu-21
|
|
|
199
213
|
sdkvm go install latest | 1.24 | 1.24.5 | golang-1.24
|
|
200
214
|
sdkvm flutter install latest | 3.47 | 3.47.5 | 3.49.0-0.1.pre | flutter-3.47
|
|
201
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
|
|
202
217
|
```
|
|
203
218
|
|
|
204
219
|
### `sdkvm install <version>`
|
|
@@ -214,16 +229,16 @@ sdkvm installed Temurin 21.0.12.1 → ~/.sdkvm/jdks/temurin-21.0.12.1
|
|
|
214
229
|
sdkvm switch to it: sdkvm use 21
|
|
215
230
|
```
|
|
216
231
|
|
|
217
|
-
| Option
|
|
218
|
-
|
|
219
|
-
| `--vendor <id>` | Java: `temurin` (default) / `zulu` / `corretto`. Go is `golang`, Flutter is `flutter`, Node.js is `nodejs` |
|
|
220
|
-
| `--force`
|
|
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 |
|
|
221
236
|
|
|
222
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.
|
|
223
238
|
|
|
224
239
|
### `sdkvm use <version>`
|
|
225
240
|
|
|
226
|
-
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`.
|
|
227
242
|
|
|
228
243
|
```sh
|
|
229
244
|
sdkvm use 21
|
|
@@ -231,9 +246,10 @@ sdkvm use temurin-21.0.5+11
|
|
|
231
246
|
sdkvm go use 1.24.5
|
|
232
247
|
sdkvm flutter use 3.47.5
|
|
233
248
|
sdkvm node use 22.20.0
|
|
249
|
+
sdkvm maven use 3.9
|
|
234
250
|
```
|
|
235
251
|
|
|
236
|
-
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).
|
|
237
253
|
|
|
238
254
|
### `sdkvm ls`
|
|
239
255
|
|
|
@@ -273,6 +289,8 @@ flutter: flutter-3.47.5
|
|
|
273
289
|
FLUTTER_HOME → ~/.sdkvm/flutters/flutter-3.47.5
|
|
274
290
|
node: nodejs-22.20.0
|
|
275
291
|
NODE_HOME → ~/.sdkvm/nodes/nodejs-22.20.0
|
|
292
|
+
maven: maven-3.9.9
|
|
293
|
+
MAVEN_HOME → ~/.sdkvm/mavens/maven-3.9.9
|
|
276
294
|
```
|
|
277
295
|
|
|
278
296
|
### `sdkvm uninstall <version>`
|
|
@@ -281,7 +299,7 @@ Same syntax as `use`. Uninstalling the current version clears that `current-*` l
|
|
|
281
299
|
|
|
282
300
|
### `sdkvm mirror`
|
|
283
301
|
|
|
284
|
-
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.
|
|
285
303
|
|
|
286
304
|
```sh
|
|
287
305
|
sdkvm mirror ls
|
|
@@ -290,11 +308,11 @@ sdkvm go mirror use aliyun
|
|
|
290
308
|
sdkvm node mirror use official # restore official source for that type
|
|
291
309
|
```
|
|
292
310
|
|
|
293
|
-
| Action
|
|
294
|
-
|
|
295
|
-
| `ls` / `current` / `show`
|
|
296
|
-
| `use <site>`
|
|
297
|
-
| `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 |
|
|
298
316
|
|
|
299
317
|
Coverage and hand-entered URLs: [Mirrors and npm registry](#mirrors-and-npm-registry).
|
|
300
318
|
|
|
@@ -317,20 +335,21 @@ Built-in names: `npm`, `yarn`, `taobao` (alias `npmmirror`), `tencent`, `cnpm`,
|
|
|
317
335
|
|
|
318
336
|
`install`, `use`, and `uninstall` share this table. Combinations that are not listed are rejected with a rewrite hint.
|
|
319
337
|
|
|
320
|
-
| Form
|
|
321
|
-
|
|
322
|
-
| `<major>`
|
|
323
|
-
| `<major.minor>`
|
|
324
|
-
| `lts`
|
|
325
|
-
| `latest`
|
|
326
|
-
| `<full-version>` | Exact or prefix
|
|
327
|
-
| `<vendor>-…`
|
|
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` |
|
|
328
346
|
|
|
329
347
|
Rules:
|
|
330
348
|
|
|
331
|
-
- `21`, `1.24`, `3.47`, and `
|
|
332
|
-
- Java `21.0.5` is a prefix and can match `21.0.5+11`. Go, Flutter,
|
|
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.
|
|
333
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.
|
|
334
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.
|
|
335
354
|
- Node.js rejects a two-part version such as `22.20`. Use `22` or `22.20.0`.
|
|
336
355
|
- Omitting the vendor uses the default distribution. Only Java's default is configurable. See [Config file](#config-file).
|
|
@@ -347,10 +366,12 @@ The data root is `~/.sdkvm` (`%USERPROFILE%\.sdkvm` on Windows). `SDKVM_HOME` ov
|
|
|
347
366
|
├── gos/ # Go: golang-1.24.5
|
|
348
367
|
├── flutters/ # Flutter: flutter-3.47.5
|
|
349
368
|
├── nodes/ # Node.js: nodejs-22.20.0
|
|
369
|
+
├── mavens/ # Maven: maven-3.9.9
|
|
350
370
|
├── current-java # JAVA_HOME link (junction on Windows)
|
|
351
371
|
├── current-go
|
|
352
372
|
├── current-flutter
|
|
353
373
|
├── current-node
|
|
374
|
+
├── current-maven
|
|
354
375
|
├── runtime/ # Script-install Node, isolated from current-node
|
|
355
376
|
├── cli/ # Script-install CLI package
|
|
356
377
|
├── bin/ # Script-install entrypoint sdkvm (add to PATH)
|
|
@@ -359,7 +380,7 @@ The data root is `~/.sdkvm` (`%USERPROFILE%\.sdkvm` on Windows). `SDKVM_HOME` ov
|
|
|
359
380
|
└── tmp/ # Extract staging, also removed
|
|
360
381
|
```
|
|
361
382
|
|
|
362
|
-
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).
|
|
363
384
|
|
|
364
385
|
### Switching
|
|
365
386
|
|
|
@@ -385,11 +406,16 @@ case ":$PATH:" in *":$FLUTTER_HOME/bin:"*) ;; *) export PATH="$FLUTTER_HOME/bin:
|
|
|
385
406
|
export NODE_HOME="$HOME/.sdkvm/current-node"
|
|
386
407
|
case ":$PATH:" in *":$NODE_HOME/bin:"*) ;; *) export PATH="$NODE_HOME/bin:$PATH";; esac
|
|
387
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 <<<
|
|
388
414
|
```
|
|
389
415
|
|
|
390
416
|
The variables point at the link. Later `use` calls only retarget that link, and a new terminal reads the new value.
|
|
391
417
|
|
|
392
|
-
On Windows the
|
|
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.
|
|
393
419
|
|
|
394
420
|
## Configuration
|
|
395
421
|
|
|
@@ -405,7 +431,8 @@ Path: `~/.sdkvm/config.json`. A corrupt file is renamed to `config.json.bak` and
|
|
|
405
431
|
"temurin": "https://mirrors.nju.edu.cn/adoptium",
|
|
406
432
|
"golang": "https://golang.google.cn/dl",
|
|
407
433
|
"flutter": "https://mirror.nju.edu.cn/flutter/flutter_infra_release",
|
|
408
|
-
"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"
|
|
409
436
|
},
|
|
410
437
|
"npmRegistries": {
|
|
411
438
|
"myprivate": "http://xxx/registry/"
|
|
@@ -413,23 +440,23 @@ Path: `~/.sdkvm/config.json`. A corrupt file is renamed to `config.json.bak` and
|
|
|
413
440
|
}
|
|
414
441
|
```
|
|
415
442
|
|
|
416
|
-
| Field
|
|
417
|
-
|
|
418
|
-
| `version`
|
|
443
|
+
| Field | Meaning | Default |
|
|
444
|
+
| --------------- | -------------------------------------------------------- | ----------- |
|
|
445
|
+
| `version` | Schema version | `1` |
|
|
419
446
|
| `defaultVendor` | Java distribution used when the vendor prefix is omitted | `"temurin"` |
|
|
420
|
-
| `mirror`
|
|
421
|
-
| `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` | `{}` |
|
|
422
449
|
|
|
423
450
|
### Environment variables
|
|
424
451
|
|
|
425
|
-
| Variable
|
|
426
|
-
|
|
427
|
-
| `SDKVM_HOME`
|
|
428
|
-
| `SDKVM_MIRROR`
|
|
429
|
-
| `SDKVM_QUIET`
|
|
430
|
-
| `SDKVM_NODE_DIST`
|
|
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 |
|
|
431
458
|
| `SDKVM_RELEASE_BASE` | GitHub Release root used by the install script and `sdkvm upgrade` |
|
|
432
|
-
| `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` |
|
|
433
460
|
|
|
434
461
|
Mirror precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official source. See [Mirrors and npm registry](#mirrors-and-npm-registry).
|
|
435
462
|
|
|
@@ -437,11 +464,11 @@ Mirror precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official source.
|
|
|
437
464
|
|
|
438
465
|
Two independent features:
|
|
439
466
|
|
|
440
|
-
|
|
|
441
|
-
|
|
442
|
-
| Changes | JDK / Go / Flutter / Node **install archive** URLs | **npm package** registry |
|
|
443
|
-
| Affects | `sdkvm … install`
|
|
444
|
-
| Scope
|
|
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 |
|
|
445
472
|
|
|
446
473
|
### SDK install mirrors
|
|
447
474
|
|
|
@@ -452,15 +479,16 @@ sdkvm mirror use nju
|
|
|
452
479
|
sdkvm go mirror use nju
|
|
453
480
|
sdkvm flutter mirror use nju
|
|
454
481
|
sdkvm node mirror use nju
|
|
482
|
+
sdkvm maven mirror use aliyun
|
|
455
483
|
```
|
|
456
484
|
|
|
457
|
-
| Site
|
|
458
|
-
|
|
459
|
-
| `nju`
|
|
460
|
-
| `tuna`
|
|
461
|
-
| `aliyun`
|
|
462
|
-
| `huawei`
|
|
463
|
-
| `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 |
|
|
464
492
|
|
|
465
493
|
Raw URL or one-shot override:
|
|
466
494
|
|
|
@@ -469,15 +497,16 @@ sdkvm go mirror set golang https://golang.google.cn/dl
|
|
|
469
497
|
SDKVM_MIRROR=https://golang.google.cn/dl sdkvm go install 1.24
|
|
470
498
|
```
|
|
471
499
|
|
|
472
|
-
Precedence: `SDKVM_MIRROR` > `config.mirror[<vendor>]` > official. A mirror replaces the archive URL only; metadata and checksums
|
|
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.
|
|
473
501
|
|
|
474
|
-
| Vendor
|
|
475
|
-
|
|
476
|
-
| Temurin
|
|
477
|
-
| Go
|
|
478
|
-
| Flutter
|
|
479
|
-
| Node.js
|
|
480
|
-
|
|
|
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 |
|
|
481
510
|
|
|
482
511
|
### npm registry
|
|
483
512
|
|
|
@@ -489,8 +518,8 @@ sdkvm nrm test # latency
|
|
|
489
518
|
|
|
490
519
|
## Security
|
|
491
520
|
|
|
492
|
-
- URLs are resolved from official APIs: Adoptium, Azul Metadata, Corretto, go.dev/dl, Flutter releases,
|
|
493
|
-
- Archives are hashed with SHA-256 as they download. Go, Flutter, and Node.js (official `SHASUMS256.txt`) abort on mismatch. If a
|
|
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.
|
|
494
523
|
- After extract, the tree must have a single root and the expected executable. Extraction always targets a fresh empty directory.
|
|
495
524
|
- Install and `sdkvm upgrade` hold `~/.sdkvm/.lock` so concurrent writers do not overwrite each other.
|
|
496
525
|
|
|
@@ -513,7 +542,8 @@ set -gx JAVA_HOME $HOME/.sdkvm/current-java
|
|
|
513
542
|
set -gx GO_HOME $HOME/.sdkvm/current-go
|
|
514
543
|
set -gx FLUTTER_HOME $HOME/.sdkvm/current-flutter
|
|
515
544
|
set -gx NODE_HOME $HOME/.sdkvm/current-node
|
|
516
|
-
|
|
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
|
|
517
547
|
```
|
|
518
548
|
|
|
519
549
|
### Flutter downloads are slow or they stop
|
|
@@ -558,17 +588,18 @@ rm -rf ~/.sdkvm/bin ~/.sdkvm/cli ~/.sdkvm/runtime
|
|
|
558
588
|
|
|
559
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.
|
|
560
590
|
|
|
561
|
-
After you no longer need the installed JDKs, Go, Flutter,
|
|
591
|
+
After you no longer need the installed JDKs, Go, Flutter, Node.js, and Maven, remove the data directory:
|
|
562
592
|
|
|
563
593
|
```sh
|
|
564
594
|
rm -rf ~/.sdkvm
|
|
565
595
|
```
|
|
566
596
|
|
|
567
597
|
Also delete these shell blocks:
|
|
598
|
+
|
|
568
599
|
- `# >>> sdkvm path >>>` … `# <<< sdkvm path <<<`
|
|
569
|
-
- each SDK’s `>>> sdkvm java|go|flutter|node init >>>` … `<<< … <<<`
|
|
600
|
+
- each SDK’s `>>> sdkvm java|go|flutter|node|maven init >>>` … `<<< … <<<`
|
|
570
601
|
|
|
571
|
-
On Windows, remove `JAVA_HOME`, `GO_HOME`, `FLUTTER_HOME`, and `
|
|
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.
|
|
572
603
|
|
|
573
604
|
## Development
|
|
574
605
|
|
|
@@ -586,8 +617,8 @@ npm run build
|
|
|
586
617
|
src/
|
|
587
618
|
├── cli/ # install / use / ls / uninstall / mirror / nrm / upgrade
|
|
588
619
|
├── core/ # version parsing, registry, config, file lock
|
|
589
|
-
├── sdk/ # java / go / flutter / node: directories, env vars, version syntax
|
|
590
|
-
├── 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
|
|
591
622
|
├── fs/ # extract, layout normalize, links
|
|
592
623
|
├── shell/ # rc writes, Windows registry
|
|
593
624
|
├── net/ # fetch, streaming download, checksums
|
|
@@ -598,4 +629,4 @@ To add a language, implement `listMajors` and `resolve` under `src/vendor/`, add
|
|
|
598
629
|
|
|
599
630
|
## License
|
|
600
631
|
|
|
601
|
-
[MIT](./LICENSE) ©
|
|
632
|
+
[MIT](./LICENSE) © qinlaoshi
|