<?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>4.0.0-wso2v146</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>

    <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.transport</groupId>
            <artifactId>axis2-transport-jms</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.transport</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>
    </dependencies>

    <build>
        <finalName>synapse</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>${argLine}</argLine>
                </configuration>
            </plugin>

            <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>
                                    <type>mar</type>
                                    <outputDirectory>target/temp/lib</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.rampart</groupId>
                                    <artifactId>rampart</artifactId>
                                    <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>
                </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>../distribution/src/main/release/docs</directory>
                            <targetPath>docs</targetPath>
                            <includes>
                                <include>release_notes.txt</include>
                            </includes>
                        </resource>
                        <resource>
                            <directory>../../src/site/resources</directory>
                            <targetPath>docs</targetPath>
                            <includes>
                                <include>Synapse_Configuration_Language.html</include>
                                <include>Synapse_Samples.html</include>
                                <include>Synapse_Samples_Setup.html</include>
                                <include>Synapse_QuickStart.html</include>
                                <include>Synapse_Extending.html</include>
                            </includes>
                        </resource>
                        <!--<resource>-->
                            <!--<directory>modules/samples/services</directory>-->
                            <!--<targetPath>samples/axis2Server/src</targetPath>-->
                        <!--</resource>-->
                        <!--<resource>-->
                            <!--<directory>modules/samples/src/main/java</directory>-->
                            <!--<targetPath>samples/axis2Client/src</targetPath>-->
                            <!--<excludes>-->
                                <!--<exclude>**/target</exclude>-->
                                <!--<exclude>**/target/**/*</exclude>-->
                            <!--</excludes>-->
                        <!--</resource>-->
                        <!--<resource>-->
                            <!--<directory>modules/samples/src/main/scripts</directory>-->
                            <!--<targetPath>samples/axis2Client</targetPath>-->
                            <!--<excludes>-->
                                <!--<exclude>custom.sh</exclude>-->
                                <!--<exclude>custom.bat</exclude>-->
                                <!--<exclude>axis2server.sh</exclude>-->
                                <!--<exclude>axis2server.bat</exclude>-->
                            <!--</excludes>-->
                        <!--</resource>-->
                        <!--<resource>-->
                            <!--<directory>modules/samples/src/main/scripts</directory>-->
                            <!--<targetPath>samples/axis2Server</targetPath>-->
                            <!--<includes>-->
                                <!--<include>axis2server.sh</include>-->
                            <!--</includes>-->
                        <!--</resource>-->
                        <!--<resource>-->
                            <!--<directory>modules/samples/src/main/scripts</directory>-->
                            <!--<targetPath>samples/axis2Server</targetPath>-->
                            <!--<includes>-->
                                <!--<include>axis2server.bat</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>
