<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.alfresco.aos-module</groupId>
    <artifactId>alfresco-aos-module-aggregator</artifactId>
    <packaging>pom</packaging>
    <version>1.6.1-A2</version>
    <name>Alfresco Office Services Module Aggregator</name>

    <scm>
        <connection>scm:git:https://github.com/Alfresco/alfresco-aos-module.git</connection>
        <developerConnection>scm:git:https://github.com/Alfresco/alfresco-aos-module.git</developerConnection>
        <url>https://github.com/Alfresco/alfresco-aos-module</url>
        <tag>1.6.1-A2</tag>
    </scm>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <maven.build.sourceVersion>${java.version}</maven.build.sourceVersion>

        <dependency.alfresco-mmt.version>6.0</dependency.alfresco-mmt.version>
        <dependency.content-service.version>23.1.0.141</dependency.content-service.version>
        <dependency.spring.version>5.3.18</dependency.spring.version>
        <license-maven-plugin.version>2.0.1.alfresco-1</license-maven-plugin.version>
    </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>

    <pluginRepositories>
        <pluginRepository>
            <id>alfresco-internal-plugin</id>
            <name>Alfresco Internal Repository</name>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <tagNameFormat>@{project.version}</tagNameFormat>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>third-party-licenses</id>
                        <goals>
                            <goal>add-third-party</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <failOnMissing>true</failOnMissing>
                            <excludedScopes>provided,test</excludedScopes>
                            <excludedGroups>org.alfresco</excludedGroups>
                            <failIfWarning>true</failIfWarning>
                            <includedLicenses>https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/includedLicenses.txt</includedLicenses>
                            <licenseMergesUrl>https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/licenseMerges.txt</licenseMergesUrl>
                            <overrideUrl>https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/override-THIRD-PARTY.properties</overrideUrl>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>alfresco-aos-repo-binding</module>
                <module>alfresco-aos-module</module>
                <module>alfresco-vti-bin</module>
                <module>packaging</module>
                <module>testclient</module>
                <module>aos-validation-tool</module>
                <module>alfresco-tas-aos-test</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run</id>
            <modules>
                <module>runner</module>
            </modules>
            <properties>
                <runner.skip.integration.tests>true</runner.skip.integration.tests>
                <runner.shutdown.tomcat>false</runner.shutdown.tomcat>
            </properties>
        </profile>
        <profile>
            <id>integrations</id>
            <properties>
                <runner.skip.integration.tests>false</runner.skip.integration.tests>
                <runner.shutdown.tomcat>true</runner.shutdown.tomcat>
            </properties>
        </profile>
        <!-- 
        #!!!VERACODE static scan needs the jars from WB-INF/lib that are copied when amp is applied
         -->
        <profile>
            <id>prepare-repo-war-with-aos</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>copy-mmt</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.alfresco</groupId>
                                            <artifactId>alfresco-mmt</artifactId>
                                            <version>${dependency.alfresco-mmt.version}</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/alfresco-mmt</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-resources-amps</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.alfresco.aos-module</groupId>
                                            <artifactId>alfresco-aos-module</artifactId>
                                            <version>${project.version}</version>
                                            <type>amp</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/amps</outputDirectory>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.alfresco</groupId>
                                            <artifactId>content-services</artifactId>
                                            <version>${dependency.content-service.version}</version>
                                            <type>war</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/war</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>apply-repo-amps</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-jar</argument>
                                        <argument>${project.build.directory}/alfresco-mmt/alfresco-mmt-${dependency.alfresco-mmt.version}.jar</argument>
                                        <argument>install</argument>
                                        <argument>${project.build.directory}/amps</argument>
                                        <argument>${project.build.directory}/war/content-services-${dependency.content-service.version}.war</argument>
                                        <argument>-directory</argument>
                                        <argument>-nobackup</argument>
                                        <argument>-force</argument>
                                        <argument>-verbose</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
