How to reuse Grails application domain classes?

I have already created the Grails application. For some reason, I need to create another console application to modify database data.

  • Can I pack my Grails application as a JAR so that the console application can reuse these domain classes?
  • Or am I adding / creating some classes in a Grails application and packaging it as a JAR and running it as a console application?
+6
source share
2 answers

If there is no better answer, I will probably use the batch-launcher plugin to do this.

+2
source

You can put the domain classes in the JAR and tell Grails that these are your domain classes by adding the Hibernate XML file (in grails-app/conf/hibernate ), which refers to the classes in this JAR. You can use this JAR in any other Java / Groovy application, but obviously they will only have save methods (dynamic crawlers, save() , etc.) when used in a Grails application.

+2
source

Source: https://habr.com/ru/post/892150/


All Articles