Home Grails create custom script that call grails commands
Reply: 1

Grails create custom script that call grails commands

Erick De Miranda Oliveira
Erick De Miranda Oliveira Published in 2017-11-28 16:24:44Z

I'm tring to create a grails scritp ('grails create-script foo') that should receive two arguments. In it's implematition, it should call some command lines like: generate-views and generate-controllers and others commands, passing one of the parameters received.

So far I've got this: includeTargets << grailsScript("_GrailsInit")

target(foo: "The description of the script goes here!") {
    def arguments= args
    //grails create-controller arguments


Anyone knows how to do this? Call a grails command inside a custom script?

Obs: I'm using grails 2.5.5

Joshua Moore
Joshua Moore Reply to 2017-11-28 20:31:27Z

This should be as easy as including the scripts you want to use in yours via includeTargets << grailsScript().

The available scripts are located in your Grails install directory under scripts.

In your case you might want to look at the contents of _GrailsCreateArtifacts.groovy.

Once you've included the correct script(s), all you need to do is call the corresponding closure.

Update The Generate-XXX scripts are provided by the scaffolding plugin. This plugin (in zip form) is located under the plugins directory of your Grails install. In the zip file you will find a scripts directory which has all the scripts for the plugin. Including the GenerateViews.groovy.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.320266 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO