I have already create a Grails application. For some reasons开发者_Python百科 I need to create another console application for someone to modify database data.
- Is it possible to package Grails application as a JAR library, so that the console application can reuse those domain classes?
- Or, I add/create some classes in Grails application and package it as a JAR and run as console application?
If no better answer, probably I will use the batch-launcher plugin to do that.
You can put the domain classes in a JAR and tell Grails that these are your domain classes by adding a Hibernate XML file (in grails-app/conf/hibernate
) that refers to the classes in this JAR. You can use this JAR in any other Java/Groovy application, but obviously they'll only have the persistence methods (dynamic finders, save()
, etc.) when used in a Grails app.
精彩评论