Chapter 2. Building

By default the Tobar Segais web application does not bundle any documentation, so in order to have a useful web application you must build a custom version that includes the desired InfoCenter plugin bundles.

The easiest way to build the Tobar Segais web application is using Apache Maven's WAR Overlays feature. Start by creating a basic pom.xml that depends on the Tobar Segais Web application:

<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
      http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mydomain.reversed</groupId>
  <artifactId>docs-webapp</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <dependencies>
    <dependency>
      <groupId>org.tobarsegais</groupId>
      <artifactId>tobar-segais-webapp</artifactId>
      <version>1.16</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>com.mydomain.reversed</groupId>
      <artifactId>docs-infocenter-plugin</artifactId>
      <version>1.0-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>
                ${project.build.directory}/${project.build.finalName}/WEB-INF/bundles
              </outputDirectory>
              <includeScope>provided</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

To build the web application, just invoke Apache Maven with a phase of “package” or later, e.g.

mvn package

The generated .war file can then be deployed in any Servlet container that supports the Servlet 2.5 specification.