官术网_书友最值得收藏!

Installing Groovy with GVM

The Groovy ecosystem continues to evolve and is not too proud to take inspiration from other sources. While the language itself has moved forwards in leaps and bounds over the last few years, by far my favorite addition to the ecosystem is GVM (Groovy enVironment Manager). GVM was inspired by tools such as RVM (Ruby Version Manager).

GVM is the ideal tool for maintaining parallel versions of the various tools in the Groovy ecosystem. GVM has a simple and intuitive command-line interface for installing and using Groovy, and a whole collection of other useful Groovy-based tools. Switching between different versions of the Grails framework is achieved with a simple command:

$gvm use grails 3.0.5
$grails run-app
$gvm u grails 3.0.5
$grails upgrade

As well as Groovy itself, GVM can be used to install most of the popular Groovy tools such as Grails, Griffon, Gradle, and Vert.x. This list is being extended by the Groovy community all the time, so for the latest list of supported tools, see the GVM tool site at http://gvmtool.net.

Installing GVM

On Linux, Mac OS X, Solaris, and FreeBSD, installation of GVM can be achieved with one simple command:

$curl –s get.gvmtool.net | bash

I like the elegance and simplicity of this installation method. If you load http://get.gvmtool.net into a browser, you will see that it is the bash installation script for GVM. The curl command downloads the script and pipes it into bash to execute. You can immediately open a new terminal window and start using GVM. Use the following commands to check the available options:

$gvm help

Installing GVM on Windows

In my experience, Windows developers fall into two camps: those who love Cygwin because it gives them the power of a Linux style Command Prompt on Windows, and those who just hate it because it imposes too many constraints. If you are the former type of developer, then you already have Cygwin and the curl package installed, which means you have already run the previous curl command, so job done!

If you are the latter, then GVM has got to be your best reason yet for giving Cygwin a spin. You can install Cygwin by running the setup program from the following address: http://cygwin.com/install.html. Pick the setup program appropriate to your system, either 32-bit or 64-bit. Cygwin does not install all packages by default, so at the end of the installation process, you will need to pick curl from the Net package category and unzip from the Archive category.

From the directory where you installed Cygwin, you can now launch the Cygwin command prompt using the Cygwin.bat command file:

C:\cygwin\Cygwin.bat
Fergal@mypc ~

You can now issue the curl command we used earlier to install GVM in your Cygwin session.

Note

Cygwin will pick up all your Windows environment and path variables. GVM itself depends on there being a valid JDK available and will look first for JAVA_HOME and then for the javac command executable to determine where this is. Make sure you have a properly configured JDK in your path somewhere. You can download and install the latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

主站蜘蛛池模板: 平武县| 左贡县| 衡水市| 勃利县| 乌拉特中旗| 资源县| 淮阳县| 南充市| 蒲江县| 澎湖县| 双流县| 潍坊市| 海原县| 宁陕县| 手游| 华蓥市| 井冈山市| 湖州市| 卢氏县| 原阳县| 滁州市| 三河市| 诸暨市| 金寨县| 恩施市| 辽阳市| 千阳县| 南召县| 镇宁| 岳阳县| 白山市| 前郭尔| 蓝田县| 班戈县| 靖江市| 陇西县| 宁阳县| 芒康县| 驻马店市| 合水县| 江华|