Skip to content

Generate Web Descriptor

pledbrook edited this page Sep 13, 2011 · 1 revision

The doWithWebDescriptor hook for plugins is the black sheep of the family. This is because it doesn't run during application startup or afterwards. Rather, Grails executes it during the build phase because the web.xml file needs to be created before the servlet container is started.

This means the rules for what is available and what can be done inside the hook are different to those for the others. For example, you can't rely on a real GrailsApplication instance being available, nor should the hook use the runtime configuration file. Yet this has never been clear and so plugins do things that work for one version of Grails but may break for another.

Since web descriptor creation happens at build time, perhaps it should be done via the build event mechanism instead? This would also allow applications to use the same mechanism.

We also need to consider the implications of the programmatic configuration provided by Servlet 3.0. This would allow the current mechanism to work properly, since doWithWebDescriptor could be executed during servlet container initialisation, rather than in the build.

Clone this wiki locally