Question

I have a project which uses groovy 1.7.5 and grails 1.3.4. but my new project yet start which will use latest version of groovy (1.8.6) and grails (2.0.4) i will be working in both project. so how to manage different versions of grails in Windows environment.

i do not want to upgrade the project which uses old version of grails(1.3.4)

Was it helpful?

Solution

There are several ways to archieve automatic version switching for grails.

I am not using windows, but a colleague of mine used a bat file for automatic version detection/switching.

Hope that helps!

P.S.: I also found this stackoverflow question.

OTHER TIPS

If you have multiple Grails versions installed on your development environment, switching Grails version for projects under development can be achieved using IDE: either STS or IntelliJ IDEA.

As an SpringSource Tool Suite (STS) IDE with Grails Tools installed user:

I have a dev environment on which I develop 2 projects each requires different Grails version (1.3.7 and 2.0.4). I have both Grails versions installed on my dev machine, with $GRAILS_HOME points to one of them as the default Grails version to use.

To quickly switch a project to use a specific installed Grails on my dev machine, I use SpringSource Tool Suite (STS) IDE with Grails Tools installed. A newer version of STS might be on its way so you'll not have to manually add Grails support yourself in the near future and hopefully STS will always comes with Grails support by default.

Assume you have STS installed with Grails support. If you're familiar with Eclipse, you already know how to use STS to manage multiple projects. To answer your question of how to switch between different Grails versions installed, first, let STS know that you have multiple Grails versions on your system:

From the top navigation bar, select 'SpringSource Tool Suite', select 'Preferences ...', in the 'type filter text' field, type in 'grails', click and highlight 'Grails', you can then manually add the paths of all installed Grails versions so STS knows their existence:

enter image description here

Further, to specify a specific installed Grails version to your project, you can right-click on the project, select Properties, select Grails, then you'll see a pulldown of multiple Grails Installation versions to choose from for your specific project. Once set, every time you run your project from within STS, the specified Grails version will be used.

enter image description here

As an IntelliJ IDEA user:

The same thing can be achieved by IDEA IDE. With your Grails project open, on the left panel, look for 'External Libraries', right click, mouse over 'Grails', then click on 'Change SDK Version'.

enter image description here

If you are on Mac or Linux, I use this simple shell script to manage all of my development platforms.

It is nice to be able use an alias that switches everything for you.

alias proj1 = 'cd /path/to/proj1; use grails 1.3.4;'
alias proj2 = 'cd /path/to/proj2; use grails 2.0.4;'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top