I recently encounter the same needs to customize the web.xml file in many Spring Roo based projects. The deal was mainly the same in this different projects : add new servlets for supporting WS or remoting protocol, add context parameters or environment entries for better customization of deployment process (across staging environments or different application servers) ...
Every time the additions into web.xml file were done manually which is a little bit cumbersome but also error prone. I end up thinking that realizing this manipulations through Roo scripts or directly into Roo shell was a good solution.
For that, I have started a new addon project on GitHub that is https://github.com/lbroudoux/spring-roo-addon-webxml. The aim of this project is to give a simple command line for adding common declaration into web.xml directly from the Roo shell.
Something like :
For writing this plugin, I found some useful informations into this Jira issue : https://jira.springsource.org/browse/ROO-62. However, the WebXmlUtils class mentionned does not offer util methods for managing environment entries. So I had to reproduce it here : https://github.com/lbroudoux/spring-...Impl.java#L162
roo> webxml add-env-entry --name myEntry --type java.lang.String --value myValue --comment "Setting up myEntry value"
roo> webxml add-servlet --name myServlet --class com.github.lbroudoux.roo.servlet.MyServlet --mapping /myServlet/* --loading 1
roo> webxml add-context-param --name myParam --value myValue --comment myComment
@Roo Community : let me know if you meet the above customization cases too and what solutions you find. Do you find this simple add-on intersting ? Any ideas to suit your needs ?
@Roo Commiters : let me know if this addition to WebXmlUtils (or the whole add-on) may be interesting. I could take some time to fork and create a pull request on GitHub.