<?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>
    <!-- ====================================================================== -->
    <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->
    <parent>
        <groupId>com.adobe.acs</groupId>
        <artifactId>acs-aem-tools</artifactId>
        <version>0.0.52</version>
    </parent>

    <!-- ====================================================================== -->
    <!-- P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->

    <artifactId>acs-aem-tools-content</artifactId>
    <name>ACS AEM Tools Package</name>
    <packaging>content-package</packaging>

    <build>
        <resources>
            <resource>
                <directory>src/main/content/jcr_root</directory>
                <excludes>
                    <exclude>**/.vlt</exclude>
                    <exclude>**/.vltignore</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/content/META-INF/vault/definition</directory>
                <targetPath>../vault-work/META-INF/vault/definition</targetPath>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <includeEmptyDirs>true</includeEmptyDirs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <group>adobe/consulting</group>
                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    <embeddeds>
                        <embedded>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>acs-aem-tools-bundle</artifactId>
                            <target>/apps/acs-tools/install</target>
                        </embedded>
                        <embedded>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>acs-aem-tools-bundle-livereload</artifactId>
                            <target>/apps/acs-tools/install</target>
                        </embedded>
                    </embeddeds>
                    <dependencies>
                        <dependency>
                            <group>day/cq60/product</group>
                            <name>cq-content</name>
                            <version>[6.2.136,)</version>
                        </dependency>
                    </dependencies>
                    <targetURL>http://${crx.host}:${crx.port}/crx/packmgr/service.jsp</targetURL>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jslint-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>jslint</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceJsFolder>src/main/content/jcr_root</sourceJsFolder>
                    <failOnIssues>true</failOnIssues>
                    <predefinedVars>jQuery,window,$</predefinedVars>
                    <excludes>
                        <exclude>**/etc/clientlibs/acs-tools/vendor/**/*.js</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/aemfiddle/code-templates/**</exclude>
                        <exclude>**/angularjs/*.js</exclude>
                        <exclude>**/aceeditor/**</exclude>
                        <exclude>**/vendor/**</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!-- configuration to create minimal package -->
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>create-min-package</id>
                        <phase>package</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>${pom.basedir}/src/main/script/CreateMinPackage.groovy</source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/${project.artifactId}-${project.version}-min.zip
                                    </file>
                                    <type>zip</type>
                                    <classifier>min</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>acs-aem-tools-bundle</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>acs-aem-tools-bundle-livereload</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>autoInstallPackage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-content-package</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
