An open API service indexing awesome lists of open source software.

https://github.com/vudsen/symbolic-link-manager

一个软连接管理工具。支持间接管理 NodeJS、Maven 和 Java 等几乎所有工具的版本,基于系统软连接实现,可高度自定义。A tool for managing system symbolic links. It supports version management for Java, Node.js, Maven, and more, and is based on system symbolic link.
https://github.com/vudsen/symbolic-link-manager

sdk-switch sdk-version-manage version-switch version-switcher

Last synced: about 1 month ago
JSON representation

一个软连接管理工具。支持间接管理 NodeJS、Maven 和 Java 等几乎所有工具的版本,基于系统软连接实现,可高度自定义。A tool for managing system symbolic links. It supports version management for Java, Node.js, Maven, and more, and is based on system symbolic link.

Awesome Lists containing this project

README

          

# symbolic-link-manager

[中文文档](/README_zh.md)

A tool to manage system symbolic link, usually used to switch SDK version.

## Install

1. Download the latest version from the [Release](https://github.com/IceOfSummer/symbolic-link-manager/releases) list and place the executable in any directory.
2. Add the following environment variables: `SLINK_MANAGER_HOME

- `SLINK_MANAGER_HOME`: the directory where the data is stored.

> [!TIP]
> When you are done, it is recommended that you add the `Path` path for easy access. Consider renaming the executable to `slm.exe` (Windows), `slm` (Linux).

## Example

### Switch Java version

We have two `Java` here:

- `C:\Program Files\Java\jdk-17`
- `C:\Program Files\Java\jdk8u432-b06`

Manage these version by the command below:

```shell
# Declare a (symbolic) link,which name is `java`
slm add link java

# Add a tag for the link
slm add tag java 17 "C:\Program Files\Java\jdk-17"
slm add tag java 8 "C:\Program Files\Java\jdk8u432-b06"

# Switch the tag
slm use java 17
```

After all, a symbolic link named `java` will be created, it will locate at `$SLINK_MANAGER_HOME/app/`. Now you should set your
`JAVA_HOME` to this directory:

- windows: `%SLINK_MANAGER_HOME%\app\java`
- linux: `$SLINK_MANAGER_HOME/app/java`

Replace the `SLINK_MANAGER_HOME` if you don't set it in environment variable.

> [!NOTE]
> Make sure you also add `%JAVA_HOME%/bin`(windows) / `$JAVA_HOME/bin`(linux) to your `Path`。

**Then reopen the terminal. You only need to reopen the terminal the first time you set up the configuration for it to take effect.**。

After all, check you java version:

![java-switch](/doc/java-switch.png)

#### Switch the Maven version when switch the version of Java

When we switched to Java 17, automatically switch the Maven version to `3.8.8`. And when using Java 8,switch Maven to `3.6.3`。

Maven directories:

- `D:\DevelopmentTool\apache-maven-3.6.3`
- `D:\DevelopmentTool\apache-maven-3.8.8`

Manage these two versions:

```shell
# Declare a (symbolic) link,which name is `maven`
slm add link maven

# Add a tag for the link
slm add tag maven 3.6 "D:\DevelopmentTool\apache-maven-3.6.3"
slm add tag maven 3.8 "D:\DevelopmentTool\apache-maven-3.8.8"

# Bind to Java (You should create it before you use.)
slm add bind java:17 maven:3.8
slm add bind java:8 maven:3.6

# Switch to maven 3.6
slm use maven 3.6
```

After this, set the environment variable `MAVEN_HOME` to `%SLINK_MANAGER_HOME%\app\maven` (windows).

Now, when you switch the Java version will switch bound Maven version too:

![绑定](/doc/bind.png)

### Switch Node.js version

NodeJS directories:

- `D:\DevelopmentTool\symbolic-link-manager\sdk\nodejs\node-v22.11.0-win-x64`
- `D:\DevelopmentTool\symbolic-link-manager\sdk\nodejs\node-v20.18.0-win-x64`

Manage these two versions:

```shell
slm add link node

slm add tag node 20 "D:\DevelopmentTool\symbolic-link-manager\sdk\nodejs\node-v20.18.0-win-x64"
slm add tag node 22 "D:\DevelopmentTool\symbolic-link-manager\sdk\nodejs\node-v22.11.0-win-x64"

slm use node 20
```

Add the `Path` variable: `D:\DevelopmentTool\symbolic-link-manager\app\node`. If you have set the `SLINK_MANAGER_HOME`,
you can use `%SLINK_MANAGER_HOME%\app\node` instead.

## Other

You can add `-h` or `--help` to see help when you use it.