<?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-repo-amps-overlay</artifactId>
    <name>Repo WAR with amps</name>
    <packaging>war</packaging>

    <parent>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-dev-community-tomcat-env</artifactId>
        <version>7.2.0.1</version>
    </parent>

    <build>
        <finalName>alfresco</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>content-services-community</artifactId>
                                    <version>${dependency.alfresco-community-repo.version}</version>
                                    <type>war</type>
                                    <outputDirectory>${project.build.directory}/alfresco</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</groupId>
                                    <artifactId>alfresco-share-services</artifactId>
                                    <version>${dependency.alfresco-community-repo.version}</version>
                                    <type>amp</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/amps</outputDirectory>
                                </artifactItem>
                                <!-- Inclusion of AOS results in
                                    java.lang.ClassNotFoundException: org.alfresco.repo.web.filter.beans.BeanProxyFilter
                                    This is probably because, the configuration of the dev tomcat, unlike production
                                    is shared between webapps and something (possibly a web.xml fragment) is
                                    incorrectly being picked up by the /share webapp. The previous version did
                                    not include aos or googledrive.
                                <artifactItem>
                                    <groupId>org.alfresco.aos-module</groupId>
                                    <artifactId>alfresco-aos-module</artifactId>
                                    <type>amp</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/amps</outputDirectory>
                                </artifactItem>
                                -->
                                <artifactItem>
                                    <groupId>org.alfresco.integrations</groupId>
                                    <artifactId>alfresco-googledrive-repo-community</artifactId>
                                    <type>amp</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/amps</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
                            </ampLocation>
                            <warLocation>${project.build.directory}/alfresco</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-repo</artifactId>
                                            <version>${dependency.alfresco-community-repo.version}</version>
                                            <type>amp</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/amps</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
