<?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.meta.ist</groupId>
        <artifactId>parent-2-public</artifactId>
        <version>1.4</version>
        <relativePath/>
    </parent>

    <groupId>com.composum.nodes</groupId>
    <artifactId>composum-nodes</artifactId>
    <version>2.7.1</version>
    <packaging>pom</packaging>

    <name>Composum Nodes</name>
    <description>Maven parent for Composum Nodes bundles</description>
    <url>https://github.com/ist-dresden/composum</url>

    <properties>
        <sling.upload.path>/libs/composum/nodes/install</sling.upload.path>
        <bundle.category>composum,nodes</bundle.category>
        <java.source>8</java.source>
        <java.target>8</java.target>
        <maven.compiler.source>${java.source}</maven.compiler.source>
        <maven.compiler.target>${java.target}</maven.compiler.target>
    </properties>

    <scm>
        <connection>scm:git:https://github.com/ist-dresden/composum.git</connection>
        <developerConnection>scm:git:https://github.com/ist-dresden/composum.git</developerConnection>
        <url>https://github.com/ist-dresden/composum.git</url>
    </scm>

    <distributionManagement>
        <repository>
            <id>${release.repository.id}</id>
            <url>${release.repository.url}</url>
        </repository>
        <!--snapshotRepository>
            <id>github</id>
            <name>GitHub Packages</name>
            <url>https://maven.pkg.github.com/ist-dresden/composum-nodes</url>
        </snapshotRepository-->
        <snapshotRepository>
            <id>istrepo</id>
            <url>https://repo.ist-software.com/repository/maven-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>jslibs</module>
        <module>commons</module>
        <module>console</module>
        <module>pckgmgr</module>
        <module>usermgr</module>
        <module>corecfg</module>
        <module>osgi</module>
        <module>setup</module>
        <module>package</module>

        <!-- Test modules - no deployed code contained -->
        <module>test</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>

                <!-- This is different than the Composum parent pom's setup since everything here are bundles, not packages.  -->
                <plugin>
                    <!-- If this is included, the build-helper-maven-plugin is also needed to actually include the minifed stuff into the JAR. -->
                    <groupId>com.samaxes.maven</groupId>
                    <artifactId>minify-maven-plugin</artifactId>
                    <version>1.7.6</version>
                    <executions>
                        <execution>
                            <id>minify-javascripts</id>
                            <configuration>
                                <webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
                                <webappTargetDir>${project.build.directory}/generated-sources/minify</webappTargetDir>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <!-- necessary to include the minfied js (see minify-maven-plugin) into the JAR. -->
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>add-minified-resource</id>
                            <phase>generate-resources</phase>
                            <goals></goals>
                            <configuration>
                                <resources>
                                    <resource>
                                        <directory>${project.build.directory}/generated-sources/minify</directory>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-maven-plugin</artifactId>
                    <configuration>
                        <user>${sling.user}</user>
                        <password>${sling.password}</password>
                    </configuration>
                </plugin>

                <!-- TODO remove when parent in composum-meta is released -->
                <!-- https://mvnrepository.com/artifact/org.apache.sling/slingfeature-maven-plugin -->
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>slingfeature-maven-plugin</artifactId>
                    <version>1.5.0</version>
                </plugin>
                <!-- https://mvnrepository.com/artifact/org.apache.sling/sling-kickstart-maven-plugin -->
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-kickstart-maven-plugin</artifactId>
                    <version>0.0.8</version>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>

        <profile>
            <!-- install bundles via Sling installer (REST API: /system/console/install) -->
            <id>installBundle</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>sling-maven-plugin</artifactId>
                        <configuration>
                            <deploymentMethod>WebConsole</deploymentMethod>
                            <slingUrl>${sling.scheme}://${sling.host}:${sling.port}${sling.context}/system/console/install</slingUrl>
                            <slingUrlSuffix/>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- install bundles via upload (WebDAV) to 'install' path (/libs/composum/nodes/install) -->
            <id>uploadBundle</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>sling-maven-plugin</artifactId>
                        <configuration>
                            <deploymentMethod>WebDAV</deploymentMethod>
                            <slingUrl>${sling.scheme}://${sling.host}:${sling.port}${sling.context}</slingUrl>
                            <slingUrlSuffix>${sling.upload.path}</slingUrlSuffix>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

    <dependencyManagement>
        <dependencies>

            <!-- Composum -->
            <dependency>
                <groupId>com.composum.nodes</groupId>
                <artifactId>composum-nodes-usermgr</artifactId>
                <version>${project.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.composum.nodes</groupId>
                <artifactId>composum-nodes-pckgmgr</artifactId>
                <version>${project.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.composum.nodes</groupId>
                <artifactId>composum-nodes-console</artifactId>
                <version>${project.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.composum.nodes</groupId>
                <artifactId>composum-nodes-commons</artifactId>
                <version>${project.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.composum.nodes</groupId>
                <artifactId>composum-nodes-jslibs</artifactId>
                <version>${project.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- downgrades - for compatibility -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.6</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.10</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-atinject_1.0_spec</artifactId>
                <version>1.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Groovy -->
            <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy -->
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy</artifactId>
                <version>3.0.7</version>
                <!--<version>[2.2,)</version>-->
                <!-- This is not neccessarily in Sling, but we don't want to include this normally because of security risks. -->
                <scope>provided</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

</project>
