<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>

    <groupId>com.composum.aem</groupId>
    <artifactId>composum-aem-microsite-parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <name>Composum AEM - Microsite...</name>
    <description>A page implementation to upload and embed a simple site as AEM content page.</description>
    <url>https://github.com/ist-dresden/composum-aem-microsite</url>

    <properties>
        <aem.sdk.api>2023.2.11289.20230224T170559Z-230100</aem.sdk.api>
        <package.group>com.composum.aem</package.group>
        <bundle.category>com.composum.aem</bundle.category>
        <release.repository.id>ossrh</release.repository.id>
        <release.repository.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</release.repository.url>
        <install.path>/apps/composum/aem/install</install.path>
        <java.source>11</java.source>
        <java.target>11</java.target>
        <maven.compiler.source>${java.source}</maven.compiler.source>
        <maven.compiler.target>${java.target}</maven.compiler.target>
        <sling.pckgmgr.uri>/crx/packmgr/service.jsp</sling.pckgmgr.uri>
        <sling.host>localhost</sling.host>
        <sling.port>4502</sling.port>
        <sling.user>admin</sling.user>
        <sling.password>admin</sling.password>
        <sling.server>http://${sling.host}:${sling.port}</sling.server>
    </properties>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Ralf Wunsch</name>
            <email>r.wunsch@ist-software.com</email>
            <organization>IST GmbH Dresden</organization>
            <organizationUrl>http://www.ist-software.com</organizationUrl>
        </developer>
    </developers>

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

    <distributionManagement>
        <repository>
            <id>${release.repository.id}</id>
            <url>${release.repository.url}</url>
        </repository>
        <snapshotRepository>
            <id>istrepo</id>
            <url>https://repo.ist-software.com/repository/maven-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>core</module>
        <module>apps</module>
        <module>conf</module>
        <module>all</module>
    </modules>

    <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>${release.repository.id}</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>

        <!-- Development profile: install only the bundle -->
        <profile>
            <id>uploadBundle</id>
            <!--
                To enable this feature for a bundle, the sling-maven-plugin
                (without configuration) needs to be included:
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-maven-plugin</artifactId>
                </plugin>
            -->
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>sling-maven-plugin</artifactId>
                            <configuration>
                                <deploymentMethod>WebDAV</deploymentMethod>
                                <slingUrlSuffix>${install.path}</slingUrlSuffix>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>server-bundle-upload</id>
                                    <phase>install</phase>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>installPackage</id>
            <!--
                To enable this feature for a bundle, the wcmio-content-package-maven-plugin
                (without configuration) needs to be included:
                <plugin>
                    <groupId>io.wcm.maven.plugins</groupId>
                    <artifactId>wcmio-content-package-maven-plugin</artifactId>
                </plugin>
            -->
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>io.wcm.maven.plugins</groupId>
                            <artifactId>wcmio-content-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-package</id>
                                    <phase>install</phase>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

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

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>${java.source}</source>
                        <target>${java.target}</target>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.1.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <charset>UTF-8</charset>
                        <encoding>UTF-8</encoding>
                        <failOnError>false</failOnError>
                        <quiet>true</quiet>
                        <notimestamp>true</notimestamp>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.6</version>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.felix/maven-bundle-plugin -->
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>5.1.4</version>
                    <extensions>true</extensions>
                </plugin>

                <plugin>
                    <groupId>org.commonjava.maven.plugins</groupId>
                    <artifactId>directory-maven-plugin</artifactId>
                    <version>0.3</version>
                    <executions>
                        <execution>
                            <id>directories</id>
                            <goals>
                                <goal>highest-basedir</goal>
                            </goals>
                            <phase>initialize</phase>
                            <configuration>
                                <property>nodepath</property>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.jackrabbit</groupId>
                    <artifactId>filevault-package-maven-plugin</artifactId>
                    <version>1.3.0</version>
                    <extensions>true</extensions>
                    <configuration>
                        <group>${package.group}</group>
                        <name>${project.artifactId}</name>
                        <failOnMissingEmbed>true</failOnMissingEmbed>
                        <embeddedTarget>${install.path}</embeddedTarget>
                        <validatorsSettings>
                            <jackrabbit-filter>
                                <options>
                                    <validRoots>/apps,/apps/composum,/apps/composum/aem</validRoots>
                                </options>
                            </jackrabbit-filter>
                            <jackrabbit-packagetype>
                                <options>
                                    <allowComplexFilterRulesInApplicationPackages>true
                                    </allowComplexFilterRulesInApplicationPackages>
                                </options>
                            </jackrabbit-packagetype>
                        </validatorsSettings>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>io.wcm.maven.plugins</groupId>
                    <artifactId>wcmio-content-package-maven-plugin</artifactId>
                    <version>2.0.4</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serviceURL>http://${sling.host}:${sling.port}${sling.pckgmgr.uri}</serviceURL>
                        <userId>${sling.user}</userId>
                        <password>${sling.password}</password>
                        <bundleStatusURL>-</bundleStatusURL>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.sling/maven-sling-plugin -->
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-maven-plugin</artifactId>
                    <version>2.4.2</version>
                    <configuration>
                        <slingUrl>http://${sling.host}:${sling.port}</slingUrl>
                        <user>${sling.user}</user>
                        <password>${sling.password}</password>
                        <failOnError>true</failOnError>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/pl.project13.maven/git-commit-id-plugin -->
                <plugin>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <version>4.0.0</version>
                    <executions>
                        <execution>
                            <id>get-the-git-infos</id>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                            <phase>initialize</phase>
                        </execution>
                    </executions>
                    <configuration>
                        <offline>true</offline>
                        <generateGitPropertiesFile>true</generateGitPropertiesFile>
                        <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
                        </generateGitPropertiesFilename>
                        <failOnNoGitDirectory>false</failOnNoGitDirectory>
                        <includeOnlyProperties>
                            <includeOnlyProperty>^git.branch$</includeOnlyProperty>
                            <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
                            <includeOnlyProperty>^git.commit.id.(abbrev|full|describe|time)$</includeOnlyProperty>
                            <includeOnlyProperty>^git.dirty$</includeOnlyProperty>
                        </includeOnlyProperties>
                        <commitIdGenerationMode>full</commitIdGenerationMode>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>
    <dependencyManagement>
        <dependencies>

            <!--dependency>
                <groupId>com.composum.aem</groupId>
                <artifactId>composum-aem-commons-core</artifactId>
                <version>${project.version}</version>
                <scope>provided</scope>
            </dependency-->

            <!-- AEM -->
            <dependency>
                <groupId>com.adobe.aem</groupId>
                <artifactId>aem-sdk-api</artifactId>
                <version>${aem.sdk.api}</version>
                <scope>provided</scope>
            </dependency>

            <!-- Java Annotations -->
            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>16.0.2</version>
                <scope>provided</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

</project>
