------ Usage ------ Pete Marvin King ------ 27 June 2006 ~~ Copyright 2006 The Apache Software Foundation. ~~ ~~ Licensed 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/guides/mini/guide-apt-format.html Usage There are 4 ways to use the war plugin : *using the package phase with the project package type as war *invocation of the <<>> goal. *invocation of the <<>> goal *invocation of the <<>> goal [] <> *Using the package phase with the project package type as war / invocation of the <<>> goal This is the common way of using the war plugin. To illustrate, given the <<>> +----------+ [...] com.example.projects documentedproject war 1.0-SNAPSHOT Documented Project http://example.com [...] +----------+ with a project structure +----------+ . |-- pom.xml `-- src `-- main |-- java | `-- com | `-- example | `-- projects | `-- SampleAction.java |-- resources | |-- images | | `-- sampleimage.jpg | `-- sampleresource `-- webapp |-- WEB-INF | `-- web.xml |-- index.jsp `-- jsp `-- websource.jsp +----------+ and invoking +----------+ mvn package +----------+ or +----------+ mvn compile war:war +----------+ generates the war file <<>>. +----------+ documentedproject-1.0-SNAPSHOT.war |-- META-INF | |-- MANIFEST.MF | `-- maven | `-- com.example.projects | `-- documentedproject | |-- pom.properties | `-- pom.xml |-- WEB-INF | |-- classes | | |-- com | | | `-- example | | | `-- projects | | | `-- SampleAction.class | | `-- images | | `-- sampleimage.jpg | `-- web.xml |-- index.jsp `-- jsp `-- websource.jsp +----------+ *Invocation of <<>> goal To speed up testing during the developement phase, war:explode can be use to generate the war in exploded form. Using the same project above and invoking +----------+ mvn compile war:exploded +----------+ would generate an exploded version of the war in <<>> +----------+ documentedproject-1.0-SNAPSHOT |-- META-INF |-- WEB-INF | |-- classes | | |-- com | | | `-- example | | | `-- projects | | | `-- SampleAction.class | | `-- images | | `-- sampleimage.jpg | `-- web.xml |-- index.jsp `-- jsp `-- websource.jsp +----------+ The default directory for the exploded war is <<>>>. The finalName is usually in the form of \-\. This default directory can be overridden by specifying the webappDirectory plugin parameter. +-------+ [...] org.apache.maven.plugins maven-war-plugin 2.0 /sample/servlet/container/deploy/directory [...] +-------+ *Invocation of <<>> goal Another variation of the <<>> is the <<>>. In <<>> the exploded war is created in the webapp source which defaults to <<>>. Using our sample project above, invoking +----------+ mvn compile war:exploded +----------+ would result to +----------+ . |-- pom.xml |-- src | `-- main | |-- java | | `-- com | | `-- ideal | | `-- projects | | `-- SampleAction.java | |-- resources | | |-- images | | | `-- sampleimage.jpg | | `-- sampleresource | `-- webapp | |-- META-INF | |-- WEB-INF | | |-- classes | | | |-- com | | | | `-- ideal | | | | `-- projects | | | | `-- SampleAction.class | | | `-- images | | | `-- sampleimage.jpg | | `-- web.xml | |-- index.jsp | `-- jsp | `-- websource.jsp `-- target `-- classes |-- com | `-- ideal | `-- projects | `-- SampleAction.class `-- images `-- sampleimage.jpg +----------+