Is there anything similar to Python virtualenv for Java or JVM Languages?
Yes(see http://www.jenv.be/), like many other languages (Ruby, Python, Go, R, Php, etc. etc.).
I have also been looking for a similar solution to simplify switching context between projects that use different Maven versions/settings and/or Java SDKs without having to modify M2_HOME
and JAVA_HOME
settings every time.
To this end, I developed a solution that helps execute mvn
commands with the appropriate configuration based on per-project settings (stored in a .mvn
folder).
See: https://github.com/AlejandroRivera/maven-env
Be aware that this only helps if you're using Maven to build and/or run your project.