<?xml version="1.0" encoding="UTF-8"?>
<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.alfresco.aos-module</groupId>
        <artifactId>alfresco-aos-module-aggregator</artifactId>
        <version>1.5.0</version>
    </parent>
    <artifactId>alfresco-aos-module</artifactId>
    <name>Alfresco Office Services Module</name>
    <packaging>amp</packaging>
    <description>Allows applications that can talk to a SharePoint server to talk to your Alfresco installation</description>

    <url>http://www.alfresco.org/</url>
    <inceptionYear>2015</inceptionYear>

    <organization>
        <name>Alfresco Software</name>
        <url>http://www.alfresco.org/</url>
    </organization>

    <licenses>
        <license>
            <name>Alfresco Component License Agreement</name>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>skopf</id>
            <name>Stefan Kopf</name>
            <email>stefan.kopf@alfresco.com</email>
            <url>http://alfresco.org</url>
            <organization>Alfresco Software</organization>
            <organizationUrl>http://alfresco.org</organizationUrl>
            <roles>
                <role>Founder</role>
                <role>Architect</role>
                <role>Developer</role>
            </roles>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <contributors>
        <contributor />
    </contributors>

    <properties>
         <!-- Version of Alfresco Community Repo to depend on -->
        <dependency.alfresco-community-repo.version>10.11</dependency.alfresco-community-repo.version>
        <dependency.postgresql.version>42.2.16</dependency.postgresql.version>
        <maven.alfresco.version>2.0.0</maven.alfresco.version>
        <app.amp.folder>${project.build.directory}/amp</app.amp.folder>
        <app.amp.output.folder>${project.build.directory}/${project.build.finalName}</app.amp.output.folder>
        <maven.fabric8.version>0.40.2</maven.fabric8.version>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
    </properties>

    <distributionManagement>
        <repository>
            <id>alfresco-internal</id>
            <url>https://artifacts.alfresco.com/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <id>alfresco-internal-snapshots</id>
            <url>https://artifacts.alfresco.com/nexus/content/repositories/internal-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>alfresco-aos-repo-binding</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${dependency.alfresco-community-repo.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-remote-api</artifactId>
            <version>${dependency.alfresco-community-repo.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${dependency.postgresql.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>
       <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${dependency.spring.version}</version>
            <type>jar</type>
            <scope>test</scope>
       </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>alfresco-internal</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/internal</url>
        </repository>
    </repositories>
    
    <pluginRepositories>
        <pluginRepository>
            <id>alfresco-internal</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/internal</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/amp</directory>
                <targetPath>${app.amp.output.folder}</targetPath>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.alfresco.maven.plugin</groupId>
                <artifactId>alfresco-maven-plugin</artifactId>
                <version>${maven.alfresco.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <snapshotToTimestamp>true</snapshotToTimestamp>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- we can skip it as we do only have integration tests -->
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${maven.fabric8.version}</version>
                <configuration>
                    <skip>${skipTests}</skip>
                    <images>
                        <image>
                            <alias>test-database</alias>  
                            <name>library/postgres:11.7</name>
                            <run>
                                <ports>
                                    <port>database.port:5432</port>
                                </ports>
                                <env>
                                    <POSTGRES_PASSWORD>alfresco</POSTGRES_PASSWORD>
                                    <POSTGRES_USER>alfresco</POSTGRES_USER>
                                    <POSTGRES_DB>alfresco-aos-module</POSTGRES_DB>
                                </env>
                                <cmd>
                                    <shell>-c max_connections=300</shell>
                                </cmd>
                                <wait>
                                    <log>database system is ready to accept connections</log>
                                    <time>20000</time>
                                </wait>
                            </run>
                        </image>
                        <image>
                            <external>
                                <type>compose</type>
                                <basedir>../testclient/docker-alfresco</basedir>
                                <composeFile>docker-compose.yml</composeFile>
                            </external>
                        </image>                    
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <systemPropertyVariables>
                        <db.name>alfresco-aos-module</db.name>
                        <db.driver>org.postgresql.Driver</db.driver>
                        <db.url>jdbc:postgresql://localhost:${database.port}/alfresco-aos-module</db.url>
                        <dir.root>${project.build.directory}/alf-data-test</dir.root>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
        	<plugins>
        		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        		<plugin>
        			<groupId>org.eclipse.m2e</groupId>
        			<artifactId>lifecycle-mapping</artifactId>
        			<version>1.0.0</version>
        			<configuration>
        				<lifecycleMappingMetadata>
        					<pluginExecutions>
        						<pluginExecution>
        							<pluginExecutionFilter>
        								<groupId>org.alfresco.maven.plugin</groupId>
        								<artifactId>alfresco-maven-plugin</artifactId>
        								<versionRange>[2.1.1,)</versionRange>
        								<goals>
        									<goal>set-version</goal>
        								</goals>
        							</pluginExecutionFilter>
        							<action>
        								<ignore />
        							</action>
        						</pluginExecution>
        					</pluginExecutions>
        				</lifecycleMappingMetadata>
        			</configuration>
        		</plugin>
        	</plugins>
        </pluginManagement>
    </build>

</project>
