Useful Batch Script for Developing Jive on Windows

Version 1
    @ECHO OFF
    REM    Usage: fix.bat [OPTION] [PLUGIN] [PLUGIN] ... [PLUGIN] where OPTION = '-c' or '-clean' and the number of plugins is >= 1. Script belongs in web directory.
    IF [%1]==[] (
      GOTO CORE
    ) ELSE IF '%1'=='-c' (
        GOTO CLEAN
    ) ELSE IF '%1'=='-clean' (
        GOTO CLEAN
    ) ELSE (
        GOTO NORMAL
    )
    
    :CLEAN
    SHIFT
    IF [%1]==[] (
        ECHO fix.bat requires the name of a plugin directory!
    ) ELSE (
        ECHO.
        ECHO.
        ECHO.
        ECHO Making a clean package for plugin: %1
        ECHO.
        ECHO.
        ECHO.
        CD "%~DP0..\%1"
        SHIFT
        CALL mvn clean package -DskipTests=true
        GOTO CORE
    )
    
    :NORMAL
    IF [%1]==[] (
        ECHO fix.bat requires the name of a plugin directory!
    ) ELSE (
        ECHO.
        ECHO.
        ECHO.
        ECHO Packaging plugin: %1
        ECHO.
        ECHO.
        ECHO.
        CD "%~DP0..\%1"
        SHIFT
        CALL mvn package -DskipTests=true
        GOTO CORE
    )
    
    :CORE
    ECHO Exit Code = %ERRORLEVEL%
    IF NOT "%ERRORLEVEL%" == "0" exit /b
    IF [%1]==[] (
        ECHO.
        ECHO.
        ECHO.
        ECHO Launching application
        ECHO.
        ECHO.
        ECHO.
        CD "%~DP0..\web"
        start.bat all
    ) ELSE (
        GOTO NORMAL
    )
    

     

     

    The script requires a simple start.bat script in the web directory! An example one looks like this:

    @ECHO OFF
    IF %1==links (
        mvn -Djive.devMode=true -Dcargo.wait=true -P int cargo:start -DpluginDirs=..\featured-links\target\featured-links-1.0-6.0.2.0
    ) ELSE IF %1==all (
        mvn -Djive.devMode=true -Dcargo.wait=true -P int cargo:start -DpluginDirs=..\featured-links\target\featured-links-1.0-6.0.2.0
    )
    

     

    The script is handy because one does not have to change directories, rebuild a plugin, and then change directories back. The whole process can be automated and can handle an arbitrary number of plugins!