I experimented using the serverXml parameter for the tomcat:run target (http://tomcat.apache.org/maven-plugin-2/tomcat6-maven-plugin/run-mojo.html#serverXml).
The following server.xml seems to work without errors, but without the Context element it does not load webapp. I think if I copied my Context element from src / main / webapp / META-INF / context.xml inside the Host element, it might work fine:
<?xml version='1.0' encoding='utf-8'?> <Server port="-1" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" /> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps"> </Host> </Engine> </Service> </Server>
To work with this server, I pass serverXml as a property on the Maven command line:
mvn -Dmaven.tomcat.serverXml=src/main/resources/server.xml tomcat:run
The target could be tomcat6:run if you are using a version of the plugin that supports both Tomcat 6 and 7.
amacleod
source share