I’m distributing a simple Java webapp as open source. The webapp needs to be configured before it can be run – a configuration file needs to be created, and the location of that configuration file needs to be made known to the webapp as a parameter in web.xml.
Now my question is how to best package and distribute the webapp in order to make it easy to install, and how to describe that installation process in the documentation. The options I can think of are:
- Distribute the webapp as a WAR archive. Recommend that users deploy the WAR into their Tomcat/Jetty/whatever, then drop their configuration file into
/webapps/myapp/WEB-INF, and modify/webapps/myapp/WEB-INF/web.xmlaccordingly - Distribute the webapp as source. Recommend that users should drop their configuration file into the
/src/main/webapp/WEB-INFfolder, then modify their/src/main/webapp/WEB-INF/web.xmlaccordingly, then build a WAR using Ant or Maven, and deploy that into their servlet container.
There are probably other options that I can’t think of.
What setup is likely to be most convenient to users that need to install, configure and deploy the webapp?
Edit: I should add that the configuration file isn’t just a few lines – it’s a large file that contains a database schema and other stuff and is potentially generated using an external editor; so just providing good defaults isn’t an option.
Externalize this configuration and maybe provide some default values. If you make a new version of your app, everybody will have to remember to back-up that configuration file, then redeploy and then copy back that file–> this is a nightmare.
There are many ways to put that configuration somewhere else. You can use Java
Preferencesfor example.