<!--
  ~ 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.axis2</groupId>
        <artifactId>axis2-parent</artifactId>
        <version>1.6.2</version>
        <relativePath>../parent/pom.xml</relativePath>
    </parent>
    <artifactId>axis2-webapp</artifactId>
    <packaging>war</packaging>
    <name>Apache Axis2 - Web Application module</name>
    <url>http://axis.apache.org/axis2/java/core/</url>
    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/tags/v1.6.2/modules/webapp</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/tags/v1.6.2/modules/webapp</developerConnection>
        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/tags/v1.6.2/modules/webapp</url>
    </scm>
    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jibx</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-java2wsdl</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-spring</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-fastinfoset</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxws</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxbri</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-xmlbeans</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-json</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>soapmonitor</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>addressing</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>ping</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>mex</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <classifier>impl</classifier>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>scripting</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-corba</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>version</artifactId>
            <version>${project.version}</version>
            <type>aar</type>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-mtompolicy</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxws-mar</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-clustering</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>mex</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>mtompolicy</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        
        <!-- Axis2 has always been shipped with Sun's implementations of
             JavaMail and JAF, although Axiom depends on (and has been tested
             with) Geronimo's implementations. This should probably reevaluated. -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>${javax.mail.version}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>axis2-${project.version}</finalName>
        <resources>
            <resource>
                <directory>../kernel/conf</directory>
                <includes>
                    <include>*.properties</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <resourceBundles>
                                <resourceBundle>org.apache.axis2:axis2-resource-bundle:${project.version}</resourceBundle>
                            </resourceBundles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-repo-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>create-repository</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/webResources/WEB-INF</outputDirectory>
                            <stripServiceVersion>false</stripServiceVersion>
                            <generateFileLists>true</generateFileLists>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- Compile the JSPs so that syntax errors are detected during the build. -->
                <groupId>org.codehaus.mojo.jspc</groupId>
                <artifactId>jspc-maven-plugin</artifactId>
                <version>2.0-alpha-3</version>
                <executions>
                    <execution>
                        <goals>
                             <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includeInProject>false</includeInProject>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo.jspc</groupId>
                        <artifactId>jspc-compiler-tomcat6</artifactId>
                        <version>2.0-alpha-3</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <!-- We only want to validate the JSPs, but not to include the compiled
                             versions in the project. However, the includeInProject parameter of
                             the jspc-maven-plugin seems to be broken (the classes are always
                             compiled to the target/classes folder) and maven-war-plugin doesn't
                             have an option to exclude specific classes or packages. Therefore
                             the only way to achieve this is to delete the files after compilation. -->
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <delete dir="${project.build.outputDirectory}/jsp" />
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <!-- We copy the axis2.xml file to the target/webResources directory
                             (instead of letting the maven-war-plugin do the job) so that
                             the file is found by maven-jetty-plugin. -->
                        <id>copy-axis2-xml</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/webResources/WEB-INF/conf</outputDirectory>
                            <resources>          
                                <resource>
                                    <directory>conf</directory>
                                    <includes>
                                        <include>axis2.xml</include>
                                    </includes>
                                </resource>
                            </resources>              
                        </configuration>            
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/webResources</outputDirectory>
                            <includeArtifactIds>axis2-soapmonitor-servlet</includeArtifactIds>
                            <includes>org/apache/axis2/soapmonitor/applet/**/*.class</includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>axis2</warName>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                    <webXml>conf/web.xml</webXml>
                    <!-- This is basically the same list as in modules/distribution/src/main/assembly/bin-assembly.xml -->
                    <packagingExcludes>
                        WEB-INF/lib/geronimo-activation_1.1_spec-*.jar,
                        WEB-INF/lib/geronimo-javamail_1.4_spec-*.jar,
                        WEB-INF/lib/spring-beans-*.jar,
                        WEB-INF/lib/spring-context-*.jar,
                        WEB-INF/lib/spring-core-*.jar,
                        WEB-INF/lib/spring-web-*.jar,
                        WEB-INF/lib/ant-*.jar,
                        WEB-INF/lib/ant-launcher-*.jar,
                        WEB-INF/lib/aopalliance-*.jar,
                        WEB-INF/lib/bsf-*.jar,
                        WEB-INF/lib/FastInfoset-*.jar,
                        WEB-INF/lib/js-*.jar
                    </packagingExcludes>
                    <webResources>
                        <resource>
                            <directory>${project.build.directory}/webResources</directory>
                        </resource>
                        <resource>
                            <directory>${basedir}/../../legal</directory>
                            <targetPath>WEB-INF/lib</targetPath>
                            <includes>
                                <include>*.txt</include>
                            </includes>
                            <excludes>
                                <exclude>servlet*.txt</exclude>
                            </excludes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.22</version>
                <configuration>
                    <webXml>conf/web.xml</webXml>
                    <webAppConfig>
                        <contextPath>/axis2</contextPath>
                        <baseResource implementation="org.mortbay.resource.ResourceCollection">
                            <resourcesAsCSV>src/main/webapp,${project.build.directory}/webResources</resourcesAsCSV>
                        </baseResource>
                    </webAppConfig>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
