您如何使用 Windows 管理使用多个版本的 Grails 进行开发? [英] How do you manage developing with multiple versions of Grails using Windows?

查看:12
本文介绍了您如何使用 Windows 管理使用多个版本的 Grails 进行开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经使用 Grails 有一段时间了,现在已经使用了几个 Grails 版本.我们并不总是想立即迁移我们的旧"应用程序,但经常使用新版本进行新开发.更改 Windows 环境变量很不方便,因为我有时必须同时处理两个运行不同版本 Grails 的相关项目.

We've been using Grails for a little while now and have been through a few Grails versions now. We don't always want to migrate our 'older' apps immediately but often use a newer version for new development. Changing the Windows environment variables is inconvenient since I sometimes have to work on two related projects at the same time that are running different versions of Grails.

在 Linux 中,我可能会创建包装脚本或别名以允许我在命令行上指定版本切换,但我认为 Grails 不支持这一点.

In Linux, I'd probably create wrapper scripts or aliases to allow me to specify on the command line a version switch but I don't believe Grails supports this.

需要针对多个 Grails 版本进行编码的其他人如何管理它?

How are others that need to code against multiple versions of Grails managing it?

更新:
我创建了一个 gv.bat 文件来设置 GRAILS\_HOMEPATH 环境变量.我在我的盒子上添加了一个 GRAILS\_INSTALLS 环境变量(c:usrlocalgrails)并删除了 %GRAILS_HOME%in来自我的 PATH 的参考.

Update:
I created a gv.bat file to set the GRAILS\_HOME and PATH environment variables. I added a GRAILS\_INSTALLS environment variable (c:usrlocalgrails on my box) and removed the %GRAILS_HOME%in reference from my PATH.

gv.bat

@echo off
SET GRAILS_HOME=%GRAILS_INSTALLS%grails-%1
SET PATH=%GRAILS_HOME%in;%PATH%

要完成任何 Grails 工作,我运行 > gv 1.1.2 或我需要使用的任何版本.我想弄清楚如何在 PATH 中进行字符串替换以更改值,但这对我来说很困难

To do any Grails work I run > gv 1.1.2 or whatever version I need to work with. I'd like to figure out how to do a string replace in the PATH to change the value but that turned out to be difficult for me

推荐答案

现在已经晚了很多,GVM 不再是以前的工具.相反,我使用 SDKMAN(https://sdkman.io/),并且 Windows 获得了一些类似 linux 的工具,或使用 Cygwin 等.它可以在 Windows 上安装.

It's now MUCH much later, and GVM is not the tool it once was. Instead, I use SDKMAN (https://sdkman.io/) and, with Windows getting some linux-like tooling, or using Cygwin, etc. it's installable on Windows.

------下面的旧答案------

------ OLD answer below ------

GVM 是 unix/mac 环境下管理 Groovy/Gradle/Grails/more 版本的工具,终于有人做了一个 Windows 等价物,叫做 Posh-gvm(Power-shell GVM 的缩写).无论您想在任何时间点使用这些工具的哪个版本,下载和配置您的环境都非常有用且易于使用.

GVM is a tool for unix/mac environments to manage Groovy/Gradle/Grails/more versions, and someone finally made a Windows equivalent called Posh-gvm (short for Power-shell GVM). It's very useful and easy to use to download and configure your environment for whichever version of these tools you want to use at any point in time.

如果您使用的是 IDE,posh-gvm 仍然是下载/安装新版本的好方法,您的 IDE 可以指向 posh-gvm 安装目录.

If you're using an IDE, posh-gvm is still a great way to download/install the new versions as they come out, and your IDE can point into the posh-gvm install directories.

这篇关于您如何使用 Windows 管理使用多个版本的 Grails 进行开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆