Victor has posted 2 posts at DZone. View Full User Profile

Using a Virtual Drive in a Project with Multiple Branches

  • submit to reddit


How many branches does your project have? I am working on a mature project with many branches supported simultaneously, and it is always headache for me when I am trying to fix some bugs that affect many versions of our project.

To fix a bug in some branch before, I had to copy an existing Intellij Idea project, configure it to a different path location (checked out from VCS to separate folder), and, after some tedious manipulations, the project was ready.

I am using Windows for development. It has this command: “subst - Associates a path with a drive letter”.  I knew about this command, but recently the brilliant idea had occurred to me. Why do I not use this command to simplify my life.

For example

  1. You check-out some file from VCS to you local drive, e.g. C:\Users\user_name\7_0-012
  2. Execute subst X: C:\Users\user_name\7_0-012 -have virtual drive pointed to root of folder C:\Users\user_name\7_0-012
  3. Create an Intellij Idea project with the source path pointed to created virtual drive
  4. If you need to switch to another project, you just execute “subst X: /D” – delete the virtual drive and then subst X: C:\Users\user_name\6_0-01. You are ready to edit source from another branch     

Of course there are some problems with third party libraries that you are using, but this depends on your dependency management system. In my case, the list of third party libraries is stable, at least for versions I support. Also I am not sure how to make the same on Unix  


Your rating: None
Published at DZone with permission of its author, Victor Tsoukanov.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Thomas Eichberger replied on Fri, 2012/01/20 - 2:29pm

There is also mklink which might offer more possibilities.

Mileta Cekovic replied on Fri, 2012/01/20 - 3:51pm

All paths in build, configuration and IDE configuration should be relative.

This way you should not have the mentioned problem, but copying only IDE project and module files would be enough.

With IntelliJ IDEA this is possible and you should really not need to exercise with the virtual drive, at least not for this reason!

Orest Ivasiv replied on Sat, 2012/01/21 - 7:28am

But there is a another choice - use Windows Sysinternals > Junction

It creats symlinks. It's very simple tool. 

You can setup some ROOT folder for your project(s) and simply changnig symlink (via junction) will do the job.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.