개요

The WAR Plugin is responsible for collecting all artifact dependencies, classes and resources of the web application and packaging them into a web application archive.

 

Goals Overview

 

 

사용

생성된 WAR 는 target 폴더안에 ${finalName} 으로 저장된다. finalName 에 변수는 ${project.artifactId}-${project.version}.war 로 대치되며 된다. war 가 저장되는 디렉터리는  webappDirectory parameter 를 수정하여 target 폴더 대신 임의의 폴더를 지정할 수 있다.

pom.xml
<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory>
          <webResources>
          <resource>
            <directory>src/main/filters/${env}</directory>
            <includes>
              <include>*.properties</include>
              <include>*.xml</include>
            </includes>
            <targetPath>WEB-INF/config</targetPath>
            <filtering>true</filtering>
          </resource>
        </webResources>
          <outputDirectory>C:\devel\apache-tomcat-7.0.42\webapps</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

 

참고 자료