How do you manage developing with multiple versions of Grails using Windows?

前端 未结 10 2481
天涯浪人
天涯浪人 2021-01-04 02:13

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 us

10条回答
  •  悲&欢浪女
    2021-01-04 02:44

    I have the same issue as you. For my concern, I have written a batch script (grails_version.bat) accessible from my Windows PATH home.

    Set up your GRAILS_HOME to your standard Grails version and each time you want to run a Grails app into another version than the standard one, open a command prompt, run the batch script (>grails_version) and run your grails commands (ex: grails run-app).

    If your are using IntelliJ, you can configure the grails version per application.

    Here is the code:

    @echo off
    
    set v11=1.1
    set v111=1.1.1
    set v12M2=1.2-M2
    set v12M3=1.2-M3
    set v12M4=1.2-M4
    set /p grails_version= What is the grails version (%v11%, %v111%, %v12M2%, %v12M3% (default), %v12M4%)?
    if "%grails_version%" == "%v11%" goto :set_grails_home 
    if "%grails_version%" == "%v111%" goto :set_grails_home 
    if "%grails_version%" == "%v12M2%" goto :set_grails_home 
    if "%grails_version%" == "%v12M3%" goto :set_grails_home 
    if "%grails_version%" == "%v12M4%" goto :set_grails_home 
    if "%grails_version%" == "" goto :set_grails_home_default 
    
    :no_valid_input
    echo The input version is not valid
    exit
    
    :set_grails_home_default
    set grails_version=%v12M3%
    
    :set_grails_home
    set GRAILS_HOME=D:\Install\grails\grails-%grails_version%
    path = %GRAILS_HOME%\bin;%PATH%
    echo GRAILS_HOME=%GRAILS_HOME%
    

    Enjoy.

提交回复
热议问题