<!--
    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>
    <groupId>org.apache.incubator</groupId>
    <artifactId>jspwiki</artifactId>
    <version>2.9.1-SNAPSHOT</version>
    <name>Apache JSPWiki (Incubating)</name>
    <description>Incubating Apache JSPWiki is a leading open source WikiWiki engine, feature-rich 
    and built around standard J2EE components (Java, servlets, JSP).</description>
    <url>http://incubator.apache.org/jspwiki/</url>

    <packaging>war</packaging>

    <prerequisites>
        <maven>3.0</maven>
    </prerequisites>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jspwiki.jdk.version>1.5</jspwiki.jdk.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>xmlrpc</groupId>
            <artifactId>xmlrpc</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-highlighter</artifactId>
            <version>3.6.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge</groupId>
            <artifactId>sandler</artifactId>
            <version>0.5</version>
        </dependency>
        <dependency>
            <groupId>opensymphony</groupId>
            <artifactId>oscache</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>oro</groupId>
            <artifactId>oro</artifactId>
            <version>2.0.7</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>com.metaparadigm</groupId>
            <artifactId>json-rpc</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.hudson</groupId>
            <artifactId>org.suigeneris.jrcs.diff</artifactId>
            <version>0.4.2</version>
        </dependency>
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.freshcookies</groupId>
            <artifactId>freshcookies-security</artifactId>
            <version>0.60</version>
        </dependency>
        <dependency>
            <groupId>ecs</groupId>
            <artifactId>ecs</artifactId>
            <version>1.4.2</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge</groupId>
            <artifactId>akismet-java</artifactId>
            <version>1.02</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.4</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>nekohtml</groupId>
            <artifactId>nekohtml</artifactId>
            <version>0.9.4</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.stripes</groupId>
            <artifactId>stripes</artifactId>
            <version>1.5.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>1.8.0.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>tomcat</groupId>
            <artifactId>jasper-runtime</artifactId>
            <version>5.5.23</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-all</artifactId>
            <version>7.6.7.v20120910</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.25.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1-beta-6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.yahoo.platform.yui</groupId>
            <artifactId>yuicompressor</artifactId>
            <version>2.4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>


    <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <testSourceDirectory>${basedir}/tests</testSourceDirectory>
        <resources>
            <resource>
                <directory>etc</directory>
                <includes>
                    <include>ini/*</include>
                </includes>
            </resource>
            <resource>
                <directory>etc/i18n</directory>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>tests/etc</directory>
                <includes>
                    <!--include>selenium/*</include-->
                    <include>ini/*</include>
                    <include>jspwiki.policy</include>
                    <include>jspwiki-testUserPolicy.policy</include>
                    <include>test.properties</include>
                    <include>log4j.properties</include>
                    <include>TextFormattingRules.txt</include>
                    <include>TestPlugins.txt</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>${jspwiki.jdk.version}</source>
                    <target>${jspwiki.jdk.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                    <server>myTomcat</server>
                    <url>http://localhost:8080/manager/text</url>
                    <path>/${project.build.finalName}</path>
                </configuration>
           </plugin>
           <plugin>
               <artifactId>maven-antrun-plugin</artifactId>
               <version>1.7</version>
               <executions>
                   <execution>
                       <phase>generate-resources</phase>
                       <configuration>
                           <target>
                               <copy file="tests/etc/userdatabase.xml.tmpl" toFile="tests/etc/userdatabase.xml"/>
                               <copy file="tests/etc/groupdatabase.xml.tmpl" toFile="tests/etc/groupdatabase.xml"/>
                               <copy file="etc/jspwiki.properties.tmpl" tofile="etc/jspwiki.properties" />
                               <copy file="tests/etc/jspwiki.properties.tmpl" tofile="target/test-classes/jspwiki.properties" />
                               <copy file="tests/etc/jspwiki_rcs.properties.tmpl" tofile="target/test-classes/jspwiki_rcs.properties" />
                               <copy file="tests/etc/jspwiki_vers.properties.tmpl" tofile="target/test-classes/jspwiki_vers.properties" />

                               <!-- Filter the properties files -->
                               <replace file="etc/jspwiki.properties"
                                        replacefilterfile="build.properties" />
                               <replace file="target/test-classes/jspwiki.properties"
                                        replacefilterfile="build.properties" />
                               <replace file="target/test-classes/jspwiki_rcs.properties"
                                        replacefilterfile="build.properties" />
                               <replace file="target/test-classes/jspwiki_vers.properties"
                                        replacefilterfile="build.properties" />

                               <!-- Create web.xml files for testing -->
                               <copy file="${basedir}/etc/web.xml" tofile="target/test-classes/WEB-INF/web.xml" />

                               <!-- For web unit tests, turn off SSL (self-signed certs b0rk
                                    the tests) and enable JDBC refs -->
                               <replace file="target/test-classes/WEB-INF/web.xml"
                                       token="CONFIDENTIAL" value="NONE" />
                               <replace file="target/test-classes/WEB-INF/web.xml"
                                       token="&lt;!--  REMOVE ME TO ENABLE JDBC DATABASE" value="" />
                               <replace file="target/test-classes/WEB-INF/web.xml"
                                       token="REMOVE ME TO ENABLE JDBC DATABASE  --&gt;" value="" />

                               <!-- For unit testing, turn on container auth -->
                               <replace file="target/test-classes/WEB-INF/web.xml"
                                       token="&lt;!--  REMOVE ME TO ENABLE CONTAINER-MANAGED AUTH" value="" />
                               <replace file="target/test-classes/WEB-INF/web.xml"
                                       token="REMOVE ME TO ENABLE CONTAINER-MANAGED AUTH  --&gt;" value="" />

                               <!-- Copy the DTDs to the test WEB-INF -->
                               <mkdir dir="target/test-classes/WEB-INF/dtd" />
                               <copy toDir="target/test-classes/WEB-INF/dtd">
                                  <fileset dir="${basedir}/etc/dtd/" />
                               </copy>

                               <!-- Copy the database configuration information -->
                               <mkdir dir="tests/etc/db/hsql" />
                               <copy file="tests/etc/jdbc.properties.tmpl" tofile="tests/etc/db/jdbc.properties" />
                                <!-- Bulk-copy the table setup/teardown scripts -->
                                <copy toDir="tests/etc/db/hsql" overwrite="true">
                                  <fileset dir="etc/db/hsql" />
                                  <filterset>
                                    <filtersfile file="target/test-classes/jspwiki.properties" />
                                    <filtersfile file="build.properties" />
                                  </filterset>
                                </copy>
                           </target>
                       </configuration>
                       <goals>
                           <goal>run</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
            <!-- Surefire plugin (running unit tests):
                 http://maven.apache.org/surefire/maven-surefire-plugin/
                 
                 Individual tests can be run command line via:
                 mvn clean test -Dtest=WikiEngineTest,AclImplTest,...
                 
                 All tests can be skipped via -Dmaven.test.skip
             -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <excludes>
                        <exclude>**/StressTestVersioningProvider.java</exclude>
                        <exclude>**/StressTestSpeed.java</exclude>
                    </excludes>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <webXml>etc/web.xml</webXml>
                    <!--webResources>
                        <resource>
                            <directory>etc</directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include name="dtd/**" />
                                <include name="jsp/**" />
                                <include name="commons-logging.properties" />
                                <include name="jspwiki.policy" />
                                <include name="jspwiki.properties" />
                                <include name="*.tld" />
                                <include name="userdatabase.xml" />
                                <include name="groupdatabase.xml" />
                                <include name="geronimo-web.xml" />
                            </includes>
                        </resource>
                    </webResources-->
                </configuration>
            </plugin>
        </plugins>
        <finalName>JSPWiki</finalName>
    </build>

</project>
