<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>it.geosolutions.geostore</groupId>
        <artifactId>geostore-web</artifactId>
        <version>2.6-SNAPSHOT</version>
    </parent>

    <artifactId>geostore-webapp</artifactId>
    <packaging>war</packaging>

    <name>GeoStore - Webapp</name>

    <developers>
        <developer>
            <name>Emanuele Tajariol</name>
            <id>ETj</id>
            <organization>GeoSolutions</organization>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- ================================================================ -->
        <!-- GeoStore modules -->
        <!-- ================================================================ -->
        <dependency>
            <groupId>it.geosolutions.geostore</groupId>
            <artifactId>geostore-persistence</artifactId>
        </dependency>
        <!-- =============================================================== -->

        <dependency>
            <groupId>it.geosolutions.geostore</groupId>
            <artifactId>geostore-rest-impl</artifactId>
        </dependency>

        <dependency>
            <groupId>it.geosolutions.geostore</groupId>
            <artifactId>geostore-rest-extjs</artifactId>
        </dependency>
        <!-- Avoids java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <!-- <scope>test</scope> -->
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-extension-providers</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-json-basic</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
        </dependency>

        <!-- =========================================================== -->
        <!-- TEST -->
        <!-- <dependency> -->
        <!-- <groupId>javax.servlet</groupId> -->
        <!-- <artifactId>javax.servlet-api</artifactId> -->
        <!-- <scope>provided</scope> -->
        <!-- </dependency> -->

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http-jetty</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-client</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- ================================================================ -->
        <!-- GeoStore modules -->
        <!-- ================================================================ -->

        <!-- JUnit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- LDAP Deps -->
        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.directory.shared</groupId>
            <artifactId>shared-ldap</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
        </dependency>

        <!-- Jetty server -->
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- =========================================================== -->
        <!--     JAVAX SERVLET & JSP                                     -->
        <!-- =========================================================== -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- if you want to create a new profile for support another DB create a
    profile including JDBC dependency and right esclusion/inclusion rule for
    load the right override file -->
    <!-- Profile for supporting Postgres -->
    <profiles>
        <profile>
            <id>postgres</id>
            <build>
                <!-- Copy the postgres custom geostore-datasource-ovr.properties -->
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <configuration>
                                    <tasks>
                                        <copy file="src/main/resources/db-conf/postgres.properties" tofile="${project.build.outputDirectory}/geostore-datasource-ovr.properties" overwrite="true" verbose="true" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

            <dependencies>
                <!-- POSTGRESQL database driver -->
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>h2_disk</id>
            <build>
                <!-- Copy the postgres custom geostore-datasource-ovr.properties -->
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <configuration>
                                    <tasks>
                                        <copy file="src/main/resources/db-conf/h2_disk.properties" tofile="${project.build.outputDirectory}/geostore-datasource-ovr.properties" overwrite="true" verbose="true" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

        </profile>

        <profile>
            <id>oracle</id>
            <build>
                <!-- Copy the postgres custom geostore-datasource-ovr.properties -->
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <configuration>
                                    <tasks>
                                        <copy file="src/main/resources/db-conf/oracle.properties" tofile="${project.build.outputDirectory}/geostore-datasource-ovr.properties" overwrite="true" verbose="true" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

            <dependencies>
                <!-- ORACLE database driver -->
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc6</artifactId>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>auditing</id>
            <dependencies>
                <dependency>
                    <groupId>it.geosolutions.geostore</groupId>
                    <artifactId>geostore-rest-auditing</artifactId>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <build>
        <finalName>geostore</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <packagingExcludes>WEB-INF/lib/apacheds-all*.jar</packagingExcludes>
                </configuration>
            </plugin>

            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.4.57.v20241219</version>
                <configuration>
                    <webApp>
                        <contextPath>/geostore</contextPath>
                    </webApp>
                    <httpConnector>
                        <port>9191</port>
                    </httpConnector>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
