I’m working on an existing WAR application that does not currently use Groovy or Grails. I am interested in using Grails to implement a new feature, with an eye toward using it more heavily in the future. However, this needs to be deployed as part of the existing WAR file.
I haven’t found any documentation talking about such a use case. I have run grails war on a test application, then dissected the resulting WAR file to see what’s in the web.xml and other configuration files. I figure I could manually add the required configuration to my existing web.xml, but at that point I’d be stuck manually maintaining it, and would lose much of the benefit of the grails command.
It seems like Grails wants full control of its own little world, and I don’t think I’m interested in going that heavily against the grain on my first project. I probably wouldn’t be using GORM (as the model isn’t a simple relational store), so Grails could be overkill in this case anyway. Perhaps something like Ratpack would be better suited to my needs.
But before abandoning Grails completely, I figured I’d see if I’m missing something obvious. Can I easily do what I want to do?
You’re right that grails expects to be in control of the war generation, but it should be possible to fit your existing project into the grails one rather than the other way round. If you do
grails install-templatesyou can edit the default grails web.xml to add in any extra bits you need.