16

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?

Konstantin Milyutin
  • 11,946
  • 11
  • 59
  • 85

1 Answers1

6

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.

Graeme Rocher
  • 7,985
  • 2
  • 26
  • 37