<?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>com.composum.platform</groupId>
        <artifactId>composum-platform-cache</artifactId>
        <version>1.6.1-SNAPSHOT</version>
    </parent>

    <artifactId>composum-platform-cache-package</artifactId>
    <packaging>content-package</packaging>

    <name>Composum Platform Cache Package</name>
    <description>the cache features for the platform bundled as a package</description>

    <build>
        <resources>

            <resource>
                <directory>src/main/content/jcr_root</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/.vlt*</exclude>
                    <exclude>**/.DS_Store</exclude>
                    <exclude>**/.gitignore</exclude>
                    <exclude>**/*.scss</exclude>
                </excludes>
            </resource>

            <resource>
                <directory>${basedir}/src/main/content/META-INF</directory>
                <targetPath>../vault-work/META-INF</targetPath>
            </resource>

            <resource>
                <directory>target/generated-css/jcr_root</directory>
                <excludes>
                    <exclude>**/*.map</exclude>
                    <exclude>**/mixins.css</exclude>
                    <exclude>**/variables.css</exclude>
                </excludes>
            </resource>

        </resources>
        <plugins>

            <!--
            <plugin>
                <groupId>nl.geodienstencentrum.maven</groupId>
                <artifactId>sass-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-css</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>update-stylesheets</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.samaxes.maven</groupId>
                <artifactId>minify-maven-plugin</artifactId>
            </plugin>
            -->

            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <configuration>

                    <group>${package.group}</group>
                    <properties>
                        <createdBy>${package.company}</createdBy>
                        <acHandling>Merge</acHandling>
                    </properties>

                    <filters>
                        <filter>
                            <root>/libs/composum/platform/cache</root>
                        </filter>
                        <filter>
                            <root>${sling.upload.path}</root>
                            <includes>
                                <include>.*/ehcache-bundle.*\.jar</include>
                                <include>.*/composum-platform-cache-bundle.*\.jar</include>
                            </includes>
                        </filter>
                    </filters>

                    <embeddeds>
                        <embedded>
                            <groupId>org.ehcache</groupId>
                            <artifactId>ehcache-bundle</artifactId>
                            <target>${sling.upload.path}</target>
                        </embedded>
                        <embedded>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>composum-platform-cache-bundle</artifactId>
                            <target>${sling.upload.path}</target>
                        </embedded>
                    </embeddeds>

                    <dependencies>
                        <dependency>
                            <group>com/composum/platform</group>
                            <name>composum-platform-commons-package</name>
                            <!-- <version>[${project.version},2.0)</version> -->
                        </dependency>
                    </dependencies>
                </configuration>
            </plugin>

        </plugins>
    </build>
    <dependencies>

        <!-- Package Bundles -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>composum-platform-cache-bundle</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ehcache</groupId>
            <artifactId>ehcache-bundle</artifactId>
            <version>${ehcache.version}</version>
        </dependency>

        <!-- Composum Core -->
        <dependency>
            <groupId>com.composum.nodes</groupId>
            <artifactId>composum-nodes-commons</artifactId>
        </dependency>

        <!-- Taglib support -->
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

    </dependencies>
    <profiles>

        <profile>
            <id>installPackage</id>
            <activation>
                <property>
                    <name>deploy.package</name>
                    <value>true</value>
                </property>
            </activation>
            <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>
