<?xml version='1.0' encoding='UTF-8'?>
<!-- 
 Copyright 2016 - 2019 Acosix GmbH

 Licensed 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>de.acosix.alfresco.site.hierarchy</groupId>
        <artifactId>de.acosix.alfresco.site.hierarchy.parent</artifactId>
        <version>1.1.0</version>
    </parent>

    <artifactId>de.acosix.alfresco.site.hierarchy.repo</artifactId>
    <name>Acosix Alfresco Site Hierarchy - Repository Module</name>

    <properties>
        <acosix.alfresco.client.version>0.1.0</acosix.alfresco.client.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.acosix.alfresco.rest.client</groupId>
                <artifactId>de.acosix.alfresco.rest.client</artifactId>
                <version>${acosix.alfresco.client.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>de.acosix.alfresco.rest.client</groupId>
                <artifactId>de.acosix.alfresco.rest.client</artifactId>
                <version>${acosix.alfresco.client.version}</version>
                <classifier>tests</classifier>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <exclusions>
                <!-- xmlfactory and cxf mess with resteasy / JAX-RS in integration tests -->
                <!-- opencmis exclusion excludes various transitive cxf inclusions -->
                <!-- none of these are needed for this specific addon -->
                <exclusion>
                    <groupId>org.alfresco</groupId>
                    <artifactId>alfresco-xmlfactory</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.chemistry.opencmis</groupId>
                    <artifactId>chemistry-opencmis-client-impl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.chemistry.opencmis</groupId>
                    <artifactId>chemistry-opencmis-server-bindings</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-rs-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>de.acosix.alfresco.utility</groupId>
            <artifactId>de.acosix.alfresco.utility.core.repo</artifactId>
            <classifier>installable</classifier>
        </dependency>

        <dependency>
            <groupId>de.acosix.alfresco.utility</groupId>
            <artifactId>de.acosix.alfresco.utility.core.repo</artifactId>
            <classifier>tests</classifier>
        </dependency>

        <dependency>
            <groupId>de.acosix.alfresco.utility</groupId>
            <artifactId>de.acosix.alfresco.utility.repo</artifactId>
        </dependency>

        <dependency>
            <groupId>de.acosix.alfresco.utility</groupId>
            <artifactId>de.acosix.alfresco.utility.repo</artifactId>
            <classifier>installable</classifier>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
        </dependency>

        <dependency>
            <groupId>de.acosix.alfresco.rest.client</groupId>
            <artifactId>de.acosix.alfresco.rest.client</artifactId>
        </dependency>

        <dependency>
            <groupId>de.acosix.alfresco.rest.client</groupId>
            <artifactId>de.acosix.alfresco.rest.client</artifactId>
            <classifier>tests</classifier>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
            
                <!-- some image customisations -->
                <!-- Maven + docker-maven-plugin result in somewhat weird inheritance handling -->
                <!-- (relying on positional order of images for overrides) -->
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <configuration>
                        <images>
                            <image>
                                <!-- no change to postgres image (first image in parent POM) -->
                            </image>
                            <image>
                                <run>
                                    <env>
                                        <!-- override JAVA_OPTS because there seems to be an issue with jdwp -->
                                        <JAVA_OPTS><![CDATA[
                                            ${docker.tests.repositoryVersionSpecificJavaOpts}
                                            -Ddb.driver=org.postgresql.Driver
                                            -Ddb.username=alfresco
                                            -Ddb.password=alfresco
                                            -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
                                            -Dcsrf.filter.enabled=false
                                            -Xms1g -Xmx1g
                                            -XX:+UseG1GC
                                            -XX:+ParallelRefProcEnabled
                                            -XX:+UseStringDeduplication
                                            -XX:+ScavengeBeforeFullGC
                                            -XX:+DisableExplicitGC
                                            -XX:+AlwaysPreTouch
                                        ]]></JAVA_OPTS>
                                    </env>
                                    <!-- add log directory mount to just the contentstore -->
                                    <!-- (cannot be done in parent POM due to hard requirement on specific project structure -->
                                    <volumes>
                                        <bind>
                                            <volume>${moduleId}-repository-test-contentstore:/usr/local/tomcat/alf_data</volume>
                                            <volume>${project.build.directory}/docker/repository-logs:/usr/local/tomcat/logs</volume>
                                        </bind>
                                    </volumes>
                                </run>
                            </image>
                        </images>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Explicitly enable Docker use (can't be done in Acosix parent POM without enabling it for all POMs,
                even if Docker use is not relevant, e.g. in intermediate parent POMs) -->
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>