Switches between java and maven versions for cmd/bash/zsh sessions.
- In addition to regular
JAVA_HOMEenvironment variable, different java versions has to be set as environment variables in order to script to work. See Environment example. - Environment variable naming should follow this convention
JAVA_HOME_<VERSION>.- Ex: JAVA_HOME_18
- Using same naming convention, more
M2_HOMEvariables can also be set for maven version switchingM2_HOME_<VERSION>.- Ex: M2_HOME_3.6
- For linux, script has to be run with
sourcefor new environment variables to be active on the session, you can create an alias for italias jvs="source jvs.sh"
-h,--helpPrints help message.-a,--aboutShows about jvs.-m <MAVEN_VERSION>,--maven <MAVEN_VERSION>Used for switching maven version.
- jvs <JAVA_VERSION>
- jvs <JAVA_VERSION> -m <MAVEN_VERSION>
- jvs 11
- jvs 1.8 -m 3.6
- jvs 18 --maven 3.8
-
Windows
-
Linux
export JAVA_HOME=/home/<user>/.jdks/openjdk-23 export JAVA_HOME_23=/home/<user>/.jdks/openjdk-23 export JAVA_HOME_22=/home/<user>/.jdks/temurin-22.0.1 export M2_HOME=/home/<user>/maven/apache-maven-3.9.8 export M2_HOME_39=/home/<user>/maven/apache-maven-3.9.8 export M2_HOME_36=/home/<user>/maven/apache-maven-3.6.0