groovy - Launch grails command from grails application -
I'm trying to run a Grails command like "grails help" from Grails App but I ended up all the efforts "Error: The main org.codehaus.groovy.grails.cli.support.GrailsStarter" can not be found or can not be loaded.
Actually, I have tried
def p1 = "grails help" .execute () p1.waitFor () println "return code: $ {p1.exitValue ()} "Println" stderr: $ {p1.err.text} "println" stdout: $ {p1.in .text} " Also:
Runtime Runtime = Runtime.Tat Timetime () Process = Runtime. XAC ("grails help") process.waitFor () Println "return code: $ {process.exitValue ()}" println "stderr: $ {process.err.text}" println "stdout: $ {process.in.text} } and finally:
def sout = new stringbuffer () def serr = new stringbuffer () last processbilder = new processbilder () processBuilder. Process (new file ("/ myFolder")) Processbuilder.command (["grails", "help"]) println processBuilder.dir Ectory () process proc = processbuilder.start () proc.consumeProcessOutput (south, serr) def status The command "grails help" is not the one I want to execute, Ekin will be necessary for me to run to fix it right up.
If I create a new app with grails 2.3. 5 ( grails create-app script-test ), then change one controller ( create grails- test the controller, run ) and change it so that it looks: Package Test Class Run Controller {DEF Index () {DFTT = ['Grays', 'Help']. Execute (). Text "and lethinum; pre & gt; ttdtat / pre & g;" }} Then run it from grails run-app , and go to localhost: 8080 / script-test / run Grails Get help on the screen provided in the form of a web page text The problem you have is that it will not work in production because you probably have a war file, so you will not know where you are, or you (If it is actually installed on the server) I think that you need to think again your strategy, whatever you are doing, you are trying to do the following: - (
Comments
Post a Comment