<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>dev-community-share-amps-overlay</artifactId>
    <name>Share WAR with amps</name>
    <packaging>war</packaging>

    <parent>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-dev-community-tomcat-env</artifactId>
        <version>26.2.0-A.9</version>
    </parent>

    <build>
        <finalName>share</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-war-file</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.alfresco</groupId>
                                    <artifactId>share</artifactId>
                                    <version>${dependency.alfresco-community-share.version}</version>
                                    <type>war</type>
                                    <outputDirectory>${project.build.directory}/share</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-base-amps</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.alfresco.integrations</groupId>
                                    <artifactId>alfresco-googledrive-share</artifactId>
                                    <version>${alfresco.googledrive.version}</version>
                                    <type>amp</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/amps-share</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.alfresco.maven.plugin</groupId>
                <artifactId>alfresco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-amps</id>
                        <goals>
                            <goal>install</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <configuration>
                            <backup>true</backup>
                            <ampLocation>
                                ${project.build.directory}/amps-share
                            </ampLocation>
                            <warLocation>${project.build.directory}/share</warLocation>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <includeWebResources>true</includeWebResources>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ags</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-ags-amp</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.alfresco</groupId>
                                            <artifactId>alfresco-governance-services-community-share</artifactId>
                                            <version>${dependency.alfresco-community-share.version}</version>
                                            <type>amp</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/amps-share</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
