In Grails 2 there was a great run-script
command that allowed to execute custom Groovy script with all project classes available. Is there something similar in Grails 3?
P.S. The only way we found is defining out own RunScriptCommand
which implements ApplicationCommand
. This command requires a separate gradle project, which we are not happy with. Is there a better way?
As an alternative, you can write an ApplicationContextCommand
see for example, the schema-export
command:
https://github.com/grails/grails-data-mapping/blob/ff6fd5148f0acc90b477e6828eb2111031b038c4/grails-plugins/hibernate4/src/main/groovy/grails/plugin/hibernate/commands/SchemaExportCommand.groovy
Which is implemented in the hibernate plugin. One you have implemented you need to add the JAR which it contains to your Gradle build script classpath.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With