Reputation: 291
When I build a war file for my Grails application via grails war
it still contains some groovy files.
After the war-filed is deployed on an application server, when and how are this files compiled to java bytecode?
Upvotes: 1
Views: 778
Reputation: 75681
The templates are there for dynamic scaffolding. For example if you have a controller like this
class PersonController {
static scaffold = Person
}
then it'll use the template to create a controller at runtime. This isn't very often used in real apps - it's more for demos and getting started - but it's an option. The dynamically generated controller and GSPs are created based on the templates and compiled in-memory.
The groovy-all jar does have code that can compile Groovy source, but that's because it's the "-all" jar. Just because it's there doesn't mean it's necessarily used. In general all compilation is done when building the war, including precompiling GSPs. This is for performance - you want the app to be as fast as possible in production.
Upvotes: 5
Reputation: 5749
The groovy files are compiled into class files before you package into the war. Check the WEB-INF/classes directory
Upvotes: 1