<?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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.roller</groupId>
        <artifactId>roller-project</artifactId>
        <version>6.0.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <name>Roller webapp</name>
    <artifactId>roller-webapp</artifactId>
    <packaging>war</packaging>

    <properties>
        <servlet.version>4.0.1</servlet.version>
        <jsp-api.version>2.2</jsp-api.version>
        <java-activation.version>1.2.0</java-activation.version>
        <java-mail.version>1.4.7</java-mail.version>
        <jstl.version>1.2</jstl.version>
        <angular.version>1.7.8</angular.version>
        <ant.version>1.10.7</ant.version>
        <asm.version>7.2</asm.version>
        <commons-validator.version>1.6</commons-validator.version>
        <commons-beanutils.version>1.9.4</commons-beanutils.version>
        <commons-httpclient.version>3.1</commons-httpclient.version>
        <commons-codec.version>1.13</commons-codec.version>
        <eclipse-link.version>2.7.5</eclipse-link.version>
        <guice.version>4.2.2</guice.version>
        <log4j.version>1.2.17</log4j.version>
        <log4j2.version>2.10.0</log4j2.version>
        <lucene.version>8.3.0</lucene.version>
        <oauth-core.version>20100527</oauth-core.version>
        <maven-war.version>3.2.3</maven-war.version>
        <maven-surefire.version>2.17</maven-surefire.version>
        <maven-antrun.version>1.0b3</maven-antrun.version>
        <rome.version>1.12.2</rome.version>
        <slf4j.version>1.7.26</slf4j.version>
        <spring.version>4.1.4.RELEASE</spring.version>
        <spring.security.version>3.2.5.RELEASE</spring.security.version>
        <struts.version>2.5.22</struts.version>
        <velocity.version>1.7</velocity.version>
        <webjars.version>1.5</webjars.version>
        <ws-commons-util.version>1.0.2</ws-commons-util.version>
        <xml-security.version>1.3.0</xml-security.version>
        <xmlrpc-version>3.1.3</xmlrpc-version>
    </properties>

    <dependencies>

        <!-- Java EE deps -->

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>${jsp-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>${java-mail.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
            <version>${java-activation.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
            <exclusions>
                <exclusion>
                    <!--api is already in the javax.activation artifact-->
                    <groupId>javax.activation</groupId>
                    <artifactId>javax.activation-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Eclipselink JPA is the default JPA implementation used by
             Roller, comment out this dependency and uncomment Hibernate's
             to use that stack instead.

             Logging, other special configuration during JUnit tests can be
             placed in the src/test/resources/roller-custom.properties file.
         -->
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa</artifactId>
            <version>${eclipse-link.version}</version>
        </dependency>

        <!-- Alternative testing with Hibernate (used by default with JBoss)
             Important: set hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
             in your roller-custom.properties if using Hibernate with Tomcat

             org.javassist:javassist:3.15.0 cannot replace differently named javassist:javassist:3.11.0
             always provided by struts2-spring-plugin so filtering it out; already provided by JBoss anyway

             Note: Apache cannot distribute Hibernate due to it being LGPL, so these dependencies must be
             commented out in trunk.  We have this dependency declaration to help with testing on JBoss
             which uses Hibernate.
        -->
        <!--dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.2.3.Final</version>
            <exclusions>
                <exclusion>
                    <groupId>org.javassist</groupId>
                    <artifactId>javassist</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.6.1</version>
            <scope>runtime</scope>
        </dependency-->

        <!-- To test with OpenJPA instead of EclipseLink, will need to add OpenJPA
             dependencies and static bytecode enhancement of the generated JPA classes
             to this pom.xml.  Check the Roller source code repository for a copy of
             this pom.xml prior to July 2013 for the necessary OpenJPA configuration -->


        <!-- Apache deps include Velocity, Struts, Lucene, HttpClient and XML-RPC -->

        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>${velocity.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.2</version>
        </dependency>
        
        <!-- explicitly adding newest asm lib to improve compatibility with latest JDKs -->

        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>${asm.version}</version>
        </dependency>

        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-commons</artifactId>
            <version>${asm.version}</version>
        </dependency>

        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-tree</artifactId>
            <version>${asm.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>${struts.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
            <version>${struts.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <version>${struts.version}</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>clipboard.js</artifactId>
            <version>2.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>3.3.1</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery-ui</artifactId>
            <version>1.12.1</version>
        </dependency>

        <dependency>
            <groupId>org.webjars.bower</groupId>
            <artifactId>summernote</artifactId>
            <version>0.8.11</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery-validation</artifactId>
            <version>1.19.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-analyzers-common</artifactId>
            <scope>compile</scope>
            <version>${lucene.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-queryparser</artifactId>
            <scope>compile</scope>
            <version>${lucene.version}</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>${commons-validator.version}</version>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>${commons-beanutils.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>${commons-httpclient.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${commons-codec.version}</version>
        </dependency>

        <dependency>
            <groupId>xml-security</groupId>
            <artifactId>xmlsec</artifactId>
            <version>${xml-security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.xmlrpc</groupId>
            <artifactId>xmlrpc-common</artifactId>
            <version>${xmlrpc-version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.xmlrpc</groupId>
            <artifactId>xmlrpc-client</artifactId>
            <version>${xmlrpc-version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.xmlrpc</groupId>
            <artifactId>xmlrpc-server</artifactId>
            <version>${xmlrpc-version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.util</groupId>
            <artifactId>ws-commons-util</artifactId>
            <version>${ws-commons-util.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <!-- Spring deps (needed only for Spring Security) -->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>aopalliance</groupId>
                    <artifactId>aopalliance</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-openid</artifactId>
            <version>${spring.security.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring.security.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>${spring.security.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <!-- Other deps include Guice and ROME -->

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>${guice.version}</version>
            <classifier>no_aop</classifier>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.jgeppert.struts2.bootstrap</groupId>
            <artifactId>struts2-bootstrap-plugin</artifactId>
            <version>2.5.2</version>
        </dependency>

        <dependency>
            <groupId>com.rometools</groupId>
            <artifactId>rome-fetcher</artifactId>
            <version>${rome.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.rometools</groupId>
            <artifactId>rome-propono</artifactId>
            <version>${rome.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>xmlrpc</groupId>
                    <artifactId>xmlrpc-common</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xmlrpc</groupId>
                    <artifactId>xmlrpc-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>webjars-servlet-2.x</artifactId>
            <version>${webjars.version}</version>
        </dependency>

        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth-provider</artifactId>
            <scope>compile</scope>
            <version>${oauth-core.version}</version>
        </dependency>

        <!-- Test deps -->

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>${ant.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbynet</artifactId>
            <version>${derby.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbyclient</artifactId>
            <version>${derby.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <finalName>roller</finalName>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven-war.version}</version>
                <configuration>
                    <attachClasses>true</attachClasses>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <webApp>
                        <contextPath>/roller</contextPath>
                    </webApp>
                    <jettyXml>src/test/resources/jetty.xml</jettyXml>
                    <systemProperties>
                        <systemProperty>
                            <name>roller.custom.config</name>
                            <value>${project.build.directory}/test-classes/roller-jettyrun.properties</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
                <dependencies>
                    <!-- Dependencies needed when using mvn jetty:run, not mvn test -->
                    <dependency>
                        <groupId>commons-dbcp</groupId>
                        <artifactId>commons-dbcp</artifactId>
                        <version>1.4</version>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derby</artifactId>
                        <version>${derby.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbyclient</artifactId>
                        <version>${derby.version}</version>
                    </dependency>
                    <dependency>
	                    <groupId>javax.mail</groupId>
	                    <artifactId>mail</artifactId>
	                    <version>${java-mail.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Activates the Derby database for unit tests and mvn jetty:run -->
            <plugin>
                <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
                <artifactId>inmemdb-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                            <type>derby</type>
                            <database>rollerdb</database>
                            <username>APP</username>
                            <password>APP</password>
                            <port>4224</port>
                            <sources>
                                <script>
                                    <sourceFile>${project.basedir}/target/dbscripts/derby/createdb.sql</sourceFile>
                                </script>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>package</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>

                <executions>

                    <execution>
                        <id>copy-main-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-dbscripts-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <includeEmptyDirs>true</includeEmptyDirs>
                            <outputDirectory>${basedir}/target/dbscripts</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/main/resources/sql</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                   
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/roller/WEB-INF/classes/dbscripts</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/dbscripts</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>**/*.sql</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

                </executions>
                
                <configuration>
                    <includeEmptyDirs>true</includeEmptyDirs>
                </configuration>

            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>project.build.directory</name>
                            <value>${basedir}/target</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <dependencies>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>${maven-antrun.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>ant</groupId>
                                <artifactId>ant</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>

                <executions>
                    <execution>
                        <id>gen-db-scripts</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <!-- Workaround for git distribution that doesn't keep empty directories.
                                     For detail check [ROL-2086] -->
                                <taskdef resource="net/sf/antcontrib/antlib.xml" />
                                <property file="${basedir}/src/main/resources/sql/dbscripts.properties" />
                                <for list="${databases}" param="database" delimiter=" ">
                                    <sequential>
                                        <mkdir dir="${basedir}/target/dbscripts/@{database}" />
                                    </sequential>
                                </for>

                                <taskdef name="texen"
                                         classname="org.apache.velocity.texen.ant.TexenTask"
                                         classpathref="maven.compile.classpath"/>
                                <texen
                                    controlTemplate  ="control.vm"
                                    contextProperties="${basedir}/src/main/resources/sql/dbscripts.properties"
                                    templatePath     ="${basedir}/src/main/resources/sql"
                                    outputDirectory  ="${basedir}/target/dbscripts"
                                    outputFile       ="README.txt"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doUpdate>false</doUpdate>
                    <revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
                </configuration>
            </plugin>

        </plugins>

        <testResources>
            <testResource>
                <directory>${project.basedir}/../app/src/main/webapp/</directory>
                <filtering>false</filtering>
                <includes>
                    <include>themes/**</include>
                </includes>
            </testResource>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/**</include>
                </includes>
            </testResource>
        </testResources>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>org/**</include>
                </includes>
                <excludes>
                    <exclude>**/sql/**</exclude>
                </excludes>
            </resource>
            <resource>
                <!-- ensure version gets substitution -->
                <directory>${project.basedir}/src/main/resources-filtered</directory>
                <filtering>true</filtering>
                <includes>
                    <include>roller-version.properties</include>
                </includes>
            </resource>
        </resources>

    </build>

</project>
