<?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.archiva</groupId>
    <artifactId>archiva-web</artifactId>
    <version>1.2-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>archiva-webapp</artifactId>
  <packaging>war</packaging>
  <name>Archiva Web :: Application</name>
  <dependencies>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-report-manager</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-scheduled</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-indexer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-proxy</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-database</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-repository-layer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-core-consumers</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-database-consumers</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-lucene-consumers</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-signature-consumers</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-applet</artifactId>
      <!-- TODO: actually, just exclude from WAR plugin -->
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-rss</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jsp-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>opensymphony</groupId>
      <artifactId>sitemesh</artifactId>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-slf4j-logging</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
    </dependency>
    <dependency>
      <groupId>com.opensymphony</groupId>
      <artifactId>webwork</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus.registry</groupId>
      <artifactId>plexus-registry-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus.registry</groupId>
      <artifactId>plexus-registry-commons</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus.cache</groupId>
      <artifactId>plexus-cache-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus.cache</groupId>
      <artifactId>plexus-cache-ehcache</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-component-api</artifactId>
    </dependency>
    <!-- Plexus Security Dependencies -->
    <dependency>
      <groupId>org.codehaus.plexus.redback</groupId>
      <artifactId>redback-xwork-content</artifactId>
      <type>war</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus.redback</groupId>
      <artifactId>redback-xwork-integration</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus.redback</groupId>
      <artifactId>redback-taglib</artifactId>
    </dependency>
    <!-- Other dependencies -->
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-webdav</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-quartz</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-taskqueue</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>stax</groupId>
      <artifactId>stax</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-http-lightweight</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-file</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging-api</artifactId>
      <version>1.1</version>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/filtered-resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <plugins>
      <!--
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>-agentlib:yjpagent</argLine>
          <excludes>
            <exclude>**/Abstract*</exclude>
            <exclude>**/*TestCase.java</exclude>
            <exclude>**/*Tests.java</exclude>
            <exclude>**/*TestSuite.java</exclude>
          </excludes>
        </configuration>
      </plugin>
       -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.1.1</version>
        <!-- This configuration is added to cleanup from war:inplace -->
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/src/main/webapp</directory>
              <includes>
                <!-- TODO: META-INF shouldn't be required, seems to be an issue with the current war plugin -->
                <include>META-INF</include>
                <include>archiva-applet.jar</include>
                <include>images/redback</include>
                <!-- Images from other wars -->
                <include>template/redback</include>
                <!-- Templates from other wars -->
                <include>WEB-INF/classes</include>
                <!-- Classes and Resources from other wars -->
                <include>WEB-INF/lib</include>
                <!-- Dependencies from other wars -->
                <include>WEB-INF/database</include>
                <!-- Database location configured in application.xml -->
                <include>WEB-INF/logs</include>
                <!-- Log file location specified in application.xml -->
                <include>redback</include>
                <!-- plexus-security css and javascript -->
                <include>css/redback</include>
                <include>WEB-INF/jsp/redback</include>
                <!-- plexus-security jsps -->
                <include>WEB-INF/template/redback</include>
                <!-- plexus-security xwork templates -->
                <include>WEB-INF/logs</include>
                <!-- Directory created by jetty:run -->
                <include>WEB-INF/temp</include>
                <!-- Directory created by jetty:run -->
                <include>WEB-INF/jasperreports</include>
                <!-- Directory created by jasperreports-maven-plugin -->
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.1</version>
        <configuration>
          <!-- Some versions of maven-war-plugin (snapshots) have this incorrectly defaulted to true.
               Specifically setting this to false to avoid accidental jar file creation. -->
          <archiveClasses>false</archiveClasses>
          <dependentWarExcludes>META-INF/**,WEB-INF/web.xml,WEB-INF/classes/xwork.xml</dependentWarExcludes>
          <warSourceExcludes>WEB-INF/lib/xalan-*.jar,WEB-INF/lib/velocity-dep-*.jar,WEB-INF/lib/xml-apis-*.jar,WEB-INF/lib/wstx-asl-*.jar,WEB-INF/lib/stax-utils-*.jar,WEB-INF/lib/xercesImpl-*.jar</warSourceExcludes>
        </configuration>
        <!-- TODO: would be good to make the jetty plugin aware of these and remove the below -->
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <!-- Needed to get the plexus-security war overlay to do its thing before jetty:run -->
              <goal>inplace</goal>
            </goals>
          </execution>  
        </executions>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.1</version>
        <configuration>
          <scanIntervalSeconds>10</scanIntervalSeconds>
          <contextPath>/</contextPath>
          <jettyEnvXml>src/jetty-env.xml</jettyEnvXml>
          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>9091</port>
              <maxIdleTime>60000</maxIdleTime>
            </connector>
          </connectors>
          <systemProperties>
            <systemProperty>
              <name>plexus.home</name>
              <value>${project.build.directory}/appserver-base</value>
            </systemProperty>
            <systemProperty>
              <name>appserver.base</name>
              <value>${project.build.directory}/appserver-base</value>
            </systemProperty>
            <systemProperty>
              <name>appserver.home</name>
              <value>${project.build.directory}/appserver-home</value>
            </systemProperty>
            <systemProperty>
              <name>derby.system.home</name>
              <value>${project.build.directory}/appserver-base/logs</value>
            </systemProperty>
          </systemProperties>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>10.1.3.1</version>
          </dependency>
          <!-- Enable the following if you want JSP 2.0 or JVM version < 1.5 <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
            <type>jar</type>
          </dependency>
          <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jcl</artifactId>
            <version>1.0.1</version>
            <type>jar</type>
          </dependency>
          <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
            <type>jar</type>
          </dependency>
           -->
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.0</version>
        <executions>
          <execution>
            <id>copy</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>archiva-applet</artifactId>
                  <version>${project.version}</version>
                  <outputDirectory>src/main/webapp</outputDirectory>
                  <destFileName>archiva-applet.jar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-maven-plugin</artifactId>
        <configuration>
          <roleDefaults>
            <roleDefault>
              <role>com.opensymphony.xwork.Action</role>
              <instantiation-strategy>per-lookup</instantiation-strategy>
            </roleDefault>
          </roleDefaults>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <copy todir="${project.build.directory}/appserver-base">
                  <fileset dir="src/appserver-base" />
                </copy>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>mysql</id>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>5.0.4</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <configuration>
              <jettyEnvXml>src/jetty-env-mysql.xml</jettyEnvXml>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>postgres</id>
      <dependencies>
        <dependency>
          <groupId>postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <version>8.2-504.jdbc3</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <configuration>
              <jettyEnvXml>src/jetty-env-postgres.xml</jettyEnvXml>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!--
        Inclusion of this profile brings in Jasper, which is not distributed by default due to ASF licensing policy
        regarding LGPL dependencies. A basic report is used instead.

        Note: in the future, it may be better to use the jasperreports plugin at all times (so the compiled report is
        included), so that we just require that the JAR be on the classpath to activate it. We haven't taken this step
        here because the jasperreports plugin is not yet released.

        See also: MRM-447
      -->
      <id>jasper</id>
      <dependencies>
        <dependency>
          <groupId>jasperreports</groupId>
          <artifactId>jasperreports</artifactId>
          <version>1.2.0</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jasperreports-maven-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>compile-reports</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <targetDirectory>src/main/webapp/WEB-INF/jasperreports</targetDirectory>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <pluginRepositories>
        <pluginRepository>
          <id>Codehaus Snapshots</id>
          <url>http://snapshots.repository.codehaus.org/</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <releases>
            <enabled>false</enabled>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</project>
