<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~  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.
  -->

<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>
    <parent>
        <groupId>org.apache.synapse</groupId>
        <artifactId>Apache-Synapse</artifactId>
        <version>3.0.1</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <groupId>org.apache.synapse</groupId>
    <artifactId>synapse-war</artifactId>
    <name>Apache Synapse - Web Application</name>
    <description>Apache Synapse - Web Application</description>
    <packaging>war</packaging>

    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/synapse/tags/Apache-Synapse-3.0.1/modules/war</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/synapse/tags/Apache-Synapse-3.0.1/modules/war</developerConnection>
        <url>http://svn.apache.org/viewvc/synapse/tags/Apache-Synapse-3.0.1/modules/war</url>
    </scm>

    <dependencies>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-samples</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-experimental</artifactId>
        </dependency>
        
        <!-- Because of a design flaw in Axis2 (see AXIS2-4265), axis2-codegen is required
             to deploy some modules => include this explicitly. -->
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-codegen</artifactId>
        </dependency>
        
        <!-- Additional transports -->
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-jms</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-vfs-transport</artifactId>
        </dependency>
        
        <!-- The patches -->
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-patches</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-documentation</artifactId>
            <type>zip</type>
            <classifier>docs</classifier>
        </dependency>
    </dependencies>

    <build>
        <finalName>synapse</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.axis2</groupId>
                                    <artifactId>addressing</artifactId>
                                    <version>${addressing.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/temp/lib</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.rampart</groupId>
                                    <artifactId>rampart</artifactId>
                                    <version>${rampart.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/temp/lib</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- This will add the patches to WEB-INF/classes. This makes sure that they have priority
                             over the original classes (which are still in the JARs in WEB-INF/lib). -->
                        <id>unpack-patches</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>synapse-patches</includeArtifactIds>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <excludes>META-INF/**/*</excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-docs</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>synapse-documentation</includeArtifactIds>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>synapse</warName>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                    <outputDirectory>target</outputDirectory>
                    <packagingExcludes>WEB-INF/lib/synapse-patches-*.jar</packagingExcludes>
                    <webResources>
                        <resource>
                            <directory>../../repository</directory>
                            <targetPath>WEB-INF/repository</targetPath>
                            <excludes>
                                <exclude>conf/web.xml</exclude>
                                <exclude>conf/axis2.xml</exclude>
                                <exclude>conf/synapse.xml</exclude>
                            </excludes>
                        </resource>
                        <!--<resource>-->
                            <!--<directory>repository/conf/sample/resources/misc/client-->
                            <!--</directory>-->
                            <!--<targetPath>samples/axis2Client/client_repo/conf</targetPath>-->
                            <!--<includes>-->
                                <!--<include>axis2.xml</include>-->
                            <!--</includes>-->
                        <!--</resource>-->
                        <!--<resource>-->
                            <!--<directory>repository/conf/sample/resources/misc/server-->
                            <!--</directory>-->
                            <!--<targetPath>samples/axis2Server/repository/conf</targetPath>-->
                            <!--<includes>-->
                                <!--<include>axis2.xml</include>-->
                            <!--</includes>-->
                        <!--</resource>-->
                        <resource>
                            <directory>../core/src/main/resources</directory>
                            <targetPath>WEB-INF/classes</targetPath>
                            <includes>
                                <include>log4j.properties</include>
                                <include>synapse.properties</include>
                                <include>identity.jks</include>
                                <include>trust.jks</include>
                            </includes>
                        </resource>
                        <resource>
                            <directory>target/temp/lib</directory>
                            <targetPath>WEB-INF/repository/modules</targetPath>
                            <includes>
                                <include>addressing-${addressing.version}.mar</include>
                                <include>rampart-${rampart.version}.mar</include>
                            </includes>
                        </resource>
                        <resource>
                            <directory>target/docs</directory>
                            <targetPath>docs</targetPath>
                        </resource>
                        <resource>
                            <directory>../distribution/src/main/release/docs</directory>
                            <targetPath>docs</targetPath>
                            <includes>
                                <include>release_notes.txt</include>
                            </includes>
                        </resource>
                        <resource>
                            <directory>../../repository/conf</directory>
                            <targetPath>WEB-INF/conf</targetPath>
                            <includes>
                                <include>axis2.xml</include>
                                <include>synapse.xml</include>
                            </includes>
                        </resource>
                        <resource>
                            <directory>../../repository/conf</directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>web.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>
