<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  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.sling</groupId>
        <artifactId>sling</artifactId>
        <version>1-incubator-SNAPSHOT</version>
        <relativePath>../parent/pom.xml</relativePath>
    </parent>

    <artifactId>sling-servlet</artifactId>
    <packaging>war</packaging>
    <version>2.0.0-incubator-SNAPSHOT</version>

    <name>Sling - Web Application</name>
    <description>
        Web Application comprising base bundles and installing Sling
        required bundles on demand
    </description>

    <scm>
        <connection>
            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/sling-servlet
        </connection>
        <developerConnection>
            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/sling-servlet
        </developerConnection>
        <url>
            http://svn.apache.org/viewvc/incubator/sling/trunk/sling-servlet
        </url>
    </scm>

    <properties>
        <!--
            Default port to start the jetty server on when running
            mvn jetty:run
            Overwrite with -D flag, e.g. mvn -Dhttp.port=9080 jetty:run
        -->
        <http.port>8080</http.port>
    </properties>

    <build>
        <plugins>
            <!-- Testing -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.5</version>
                <configuration>
                    <contextPath>/</contextPath>
                    <connectors>
                        <connector
                            implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                            <port>${http.port}</port>
                            <maxIdleTime>60000</maxIdleTime>
                            <headerBufferSize>32768</headerBufferSize>
                        </connector>
                    </connectors>
                    <webAppSourceDirectory>
                        target/${artifactId}-${pom.version}
                    </webAppSourceDirectory>
                    <webXml>src/test/webapp/WEB-INF/web.xml</webXml>
                </configuration>
            </plugin>

            <!-- Unpack the sling-app launcher for inclusion in the web app -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>
                                sling-app,servlet
                            </includeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                            <outputDirectory>
                                ${project.build.directory}/sling-app
                            </outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>
                                true
                            </overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Include sling-app launcher classes and resources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webResources>
                        <!-- the classes (except unneeded Main) -->
                        <resource>
                            <directory>
                                ${basedir}/target/sling-app
                            </directory>
                            <targetPath>WEB-INF/classes</targetPath>
                            <excludes>
                                <exclude>
                                    org/apache/sling/launcher/main/**
                                </exclude>
                                <exclude>
                                    resources/bundles/org.apache.felix.http.jetty*.jar
                                </exclude>
                                <exclude>
                                    resources/bundles/org.apache.felix.commons.servlet-api*.jar
                                </exclude>
                            </excludes>
                            <includes>
                                <include>org/**</include>
                            </includes>
                        </resource>
                        <!-- the configuration resources -->
                        <resource>
                            <directory>
                                ${basedir}/target/sling-app
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>resources/**</include>
                                <include>sling.properties</include>
                                <include>
                                    sling_install.properties
                                </include>
                                <include>jre-*.properties</include>
                            </includes>
                            <excludes>
                                <exclude>
                                    resources/bundles/org.apache.felix.http.jetty*.jar
                                </exclude>
                                <exclude>
                                    resources/bundles/org.apache.felix.commons.servlet-api*.jar
                                </exclude>
                            </excludes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

            <!-- For the servlet-bridge, the jar file is required -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-classes</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>classes</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>sling-app</artifactId>
            <version>2.0.0-incubator-SNAPSHOT</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>javax.servlet</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.equinox.http</groupId>
            <artifactId>servlet</artifactId>
            <version>1.0.0.v20070606</version>
            <scope>provided</scope>
        </dependency>

        <!-- The servlet container will have to provide these API classes -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
        </dependency>

    </dependencies>

</project>

