In a existing Maven app, create the following structure:
src
|-main
|-filters
|-tomcat.properties
|-resources
|-context.xml
In your pom.xml we have something like
:
in tomcat.properties
context.docBase=${basedir}/target/${project.build.finalName}
context.path=/${project.build.finalName}
and in context.xml
Once you have all of this in place (along with a good cargo config found in this post) you will be on your way to a enjoyable, easy development setup.
So now, all you have to do to hot deploy your maven app to a running instance of Tomcat is type the following: mvn install -Ptomcat
This will compile and deploy your changes quickly. You can also set your IDE to copy jsp/xhtml files over using a keyboard shortcut mapping (easy to do with Idea) so for UI changes you don't have to hot deploy every time.
This example just scratches the surface of what mixing profiles with filtering can do. You could have a filtering/profile mechanism for every possible scenario.
No comments:
Post a Comment