How does one manage the use of multiple versions of a software tool, such as a programming language or framework?
In a blog post the author, Jeff, shows a way to switch between versions of his development tools, using the Grails framework as an example. In Linux he creates symlink to the specific version. He further uses aliases in the ~/.profile to allow quick changes to these symlinks. Nice post.
Many, I’m sure, have been using that approach, symlinks to the current version. For example, on Windows 7, I use directory junctions. Below is a snippet of my java folder. Notice that all the Groovy versions are in the GroovyVersions subfolder and the file “groovy” will point to one of these.
Directory of c:java 04/07/2010 05:55 PM <JUNCTION> groovy
The built-in command to create a junction in Windows 7 is:
Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target
/D Creates a directory symbolic link. Default is a file
So, to create the shown link one would execute:
mklink /J groovy c:javaGroovyVersionsgroovy-1.7.2
or should that be:
mklink /D groovy c:javaGroovyVersionsgroovy-1.7.2
(todo: review the differences between a junction and a softlink)
Changing to a particular would now require delete of the current junction and then creation of a new one to point to the desired version. However, this is clunky. Jeff used shell aliases which could just as easily be done in Windows using batch files or PowerShell commands.
As the original blog post mentioned, this allows easier control over the environment. Thus, GROOVY_HOME environment variable would not have to change. It would remain, GROOVY_HOME=C:javagroovy
There are already systems to handle versioning of software in an OS. One approach that works on Linux is GVM.