Sometimes we face a problem with our grails system, means we have many applications to work with which are built using different grails versions. So switching between grails version is a terrible task, like switching symbolic links or changing GRAILS_HOME environment variable each time when we run our different application.
How can we solve it?
The best way which i found is GVM, which stands for Groovy enVironment Manager. This is a tool to manage various versions of different services e.g., Grails, Groovy etc.
Here I’ll talk about steps to use GVM to make your life more ease.
1. You can install gvm by using “curl -s get.gvmtool.net | bash”.
This command will create a .gvm folder on your machine inside your home directory. And downloads all necessary files for execution of gvm commands.
Note: By use of “gvm help”. You can check GVM install or not.
2. You can use “gvm install grails” for installation of latest version of Grails. If you want to install Grails 2.3.7 version than you can use “gvm install grails 2.3.7”. What will it do? It will download and install necessary binary file of your selected grails version in to .gvm folder.
Note: It will prompt you to choose current installed version as a default Grails version, or you can decide later by using “gvm default grails 2.3.7” command.
3. You can switch grails version very easily by “gvm use grails 2.2.2” command.
4. Finally, run your application.
Some Important commands for GVM are as following .
1. To uninstall Grails 2.2.2, you use “gvm uninstall grails 2.2.2”.
2. To check, list of install services on your machine by using“gvm current” command.
3. To check, Grails available version on your machine by using “gvm current grails”command.
4. To check GVM version by using “gvm version” command.
Note: This is an example of Grails. It supports Groovy, Gaiden, Griffon, Gradle etc.