Search code examples
grailsmaven-3grails-plugingrails-config

Grails Disable run-app command


In our project there is a requirement like force all user to use mvn for running the grails application. So I have a task assigned for it like disable the run-app support or override run-app command so when other guy try to run application using grails runApp it will show some message and should exit. Can any body help please.


Solution

  • HI I resolved it by doing following step:

    I created _Events.groovy by executing "grails create-script _Events". By doing this it will create _Events.groovy in scripts directory and in eventCompileStart I have written following code and it works fine for me.

    eventCompileStart = {
    if( BuildSettingsHolder.settings.grailsHome){
      println"""
                  *********************************************************
                  *        "grails run-app" support is disabled           *
                  *                                                       *
                  *       Try to run "mvn clean grails:run-app"           *
                  *                                                       *
                  *********************************************************
         """
        System.exit(0)
    }
    

    }

    I hope it will help some one.