How does one manage the use of multiple versions of a software tool, such as a programming language or framework?
*inux
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.
Windows 7
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.
c:java>dir Directory of c:java 04/07/2010 05:55 PM <JUNCTION> groovy
|
The built-in command to create a junction in Windows 7 is:
c:java>mklink /? 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 versions
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.
Advantages
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
Updates
There are already systems to handle versioning of software in an OS. One approach that works on Linux is GVM.
Links
GVM
NTFS Hard Links, Directory Junctions, and Windows Shortcuts
NFTF symbolic link
NTFS junction point
Symbolic Links on MSDN
Using a Virtual Drive in a Project with Multiple Branches
One thought on “Switching between versions of tools”