<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.3</version>
        <relativePath/>
    </parent>

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

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

    <properties>
        <bundle.category>composum,nodes</bundle.category>
        <package.failOnError>true</package.failOnError>
        <bundle.failOnError>true</bundle.failOnError>
        <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>

    <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>corepckg</module>
        <module>nodes4aem</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>
                                <!-- source maps wouldn't work since js are combined into one file later. -->
                                <closureCreateSourceMap>false</closureCreateSourceMap>
                                <verbose>false</verbose>
                                <skipMerge>true</skipMerge>
                                <jsEngine>CLOSURE</jsEngine>

                                <webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
                                <webappTargetDir>${project.build.directory}/generated-sources/minify</webappTargetDir>

                                <jsSourceDir>.</jsSourceDir>
                                <jsTargetDir>.</jsTargetDir>
                                <jsSourceIncludes>
                                    <jsSourceInclude>**/*.js</jsSourceInclude>
                                </jsSourceIncludes>
                                <jsSourceExcludes>
                                    <jsSourceExclude>**/*.min.js</jsSourceExclude>
                                    <!-- Also exclude local development stuff excluded from git. -->
                                    <jsSourceExclude>**/local-*/**/*.js</jsSourceExclude>
                                    <jsSourceExclude>**/.local-*/**/*.js</jsSourceExclude>
                                </jsSourceExcludes>

                                <!-- No css minify - that's done in the application. -->
                                <cssSourceDir>.</cssSourceDir>
                                <cssSourceExcludes>
                                    <cssSourceExclude>**</cssSourceExclude>
                                </cssSourceExcludes>
                            </configuration>
                            <goals>
                                <goal>minify</goal>
                            </goals>
                        </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>
                                <goal>add-resource</goal>
                            </goals>
                            <configuration>
                                <resources>
                                    <resource>
                                        <directory>${project.build.directory}/generated-sources/minify</directory>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

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

    <profiles>

        <profile>
            <!-- profile to release the artifacts for the public repository -->
            <id>nexus-staging</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>info@composum.com</keyname>
                                </configuration>
                            </execution>
                        </executions>
                    </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>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.10</version>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-atinject_1.0_spec</artifactId>
                <version>1.0</version>
            </dependency>

            <!-- YUICompressor -->
            <!-- https://mvnrepository.com/artifact/com.yahoo.platform.yui/yuicompressor -->
            <dependency>
                <groupId>com.yahoo.platform.yui</groupId>
                <artifactId>yuicompressor</artifactId>
                <version>2.4.8</version>
            </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>
