--- Run Mojo --- Oliver Lamy --- 2011-01-10 --- ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Run Mojo: run your Maven war project quickly ! When developping a war project, you usually build your war and deploy it to an installed Tomcat instance. This is time and resources consuming and take time to install locally the instance. The run mojo give you the opportunity to save that by simply running your war inside an embeded Tomcat instance in your Maven build. <<>> If you have a multi module Maven projects and use Maven3, you don't need to install all modules before use the run goal, just use tomcat6/7:run from the root module and the plugin will auto detect build output directory from various modules and replace dependencies with those directories in the webapp classloader. * Run an embeded Tomcat Configure your pom with the plugin version (for other mojo parameters see each mojo documentation details). And use: mvn tomcat6/7:run +--------------------- org.apache.tomcat.maven tomcat7-maven-plugin ${project.version} 9090 / ${tomcatContextXml} ${project.build.directory}/appserver-base ${project.build.directory}/appserver-home ${project.build.directory}/appserver-base/logs ${project.build.directory} false org.apache.derby derby ${derbyVersion} javax.mail mail 1.4 +--------------------- * Maven project structure +--------------------- pom.xml (top level pom with packaging pom) my-api/pom.xml (api project with packaging jar) my-api-impl/pom.xml (api implementation project with packaging jar) my-webapp/pom.xml (webapp project with packaging war) +--------------------- With a such structure, from the top level directory use mvn tomcat6/7:run -pl :my-webapp -am. * Use it with selenium mojo You can use the mojo, to start your application in a Tomcat instance and run you selenium test against this instance. The following configuration will start an emdeded tomcat in pre-integration-test and stop it in post-integration-test. +--------------------- org.apache.tomcat.maven tomcat7-maven-plugin ${project.version} tomcat-run run-war-only pre-integration-test .... true .... tomcat-shutdown shutdown post-integration-test +---------------------