java - Calling grails commands from grails events? -
i need call plugin arguments grails event script. how do this?
specifically, i'm trying hook eventcompile call generate-dto --all, sending y stdin.
the easiest (and slowest) way invoke grails in event handler. bit tricky, since generate-dto generates compile event, can make conditional on system property. second problem required input. convention, grails scripts supposed accept --non-interactive , not prompt user, dto plugin seems not follow this. workaround posix systems linux or macos x pipe in yes command grails input.
here's how got working:
// scripts/_events.groovy eventcompilestart = { args -> if (boolean.valueof(system.getproperty('in.generate', "false"))) { // skip } else { ['bash', '-c', 'yes | grails -din.generate=true generate-dto --all'].execute() } }
Comments
Post a Comment