How we have the development specific code safely out of the way
Quite frequently, one has to write some development specific code. For example, at work, we have, when needed, an “application launcher” (named with the application name) and a dev web page, mounted under /dev. This page in turn allows to write shortcuts in the application work flow, in order to access specific page with an ad hoc environment (profile, data…).
However, one quickly wonders how to be sure these classes won’t get in production.
Our solution is linked to m2eclipse. This maven plugin for eclipse has the following behavior : it puts both the main and test source paths in the class path. As such, one can access both the production and test code when running the application from eclipse. This is normally not done by Maven. More precisely, Maven build jars don’t include the test code.
The solution is then really easy : we put our dev. specific code under the test branch, and we are perfectly able to run it all from eclipse. But Maven makes sure none of it will make it into the production jar/code. Double with this application launcher + dev page conventions, it really makes it simple to dig into an application/project. Nice and easy no ?