Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run-script alternative in Grails 3

Tags:

grails

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?

like image 643
Konstantin Milyutin Avatar asked Jun 02 '15 08:06

Konstantin Milyutin


1 Answers

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.

like image 59
Graeme Rocher Avatar answered Oct 13 '22 23:10

Graeme Rocher