<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 https://maven.apache.org/xsd/maven-4.0.0.xsd" child.project.url.inherit.append.path="false">
    <modelVersion>4.0.0</modelVersion>
    <groupId>biz.netcentric.filevault.validator</groupId>
    <artifactId>aem-classification</artifactId>
    <version>1.2.1</version>
    <packaging>pom</packaging>
    <name>AEM Classification Reactor</name>
    <description>Reactor project building both the FileVault validator and the Maven Plugin</description>

    <url>https://github.com/Netcentric/aem-classification</url>
    <inceptionYear>2020</inceptionYear>

    <organization>
        <name>Cognizant Netcentric</name>
        <url>https://www.netcentric.biz/</url>
    </organization>
    <developers>
        <developer>
            <name>Konrad Windszus</name>
            <email>konrad.windszus@netcentric.biz</email>
            <id>konrad.windszus@netcentric.biz</id>
            <organization>Cognizant Netcentric</organization>
            <organizationUrl>https://www.netcentric.biz/</organizationUrl>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Eclipse Public License, Version 1.0</name>
            <url>https://www.eclipse.org/legal/epl-v10.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <!-- using adjusted inheritance rules: https://issues.apache.org/jira/browse/MNG-6059 -->
    <scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
        <connection>scm:git:ssh://git@github.com/Netcentric/aem-classification.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/Netcentric/aem-classification.git</developerConnection>
        <url>https://github.com/Netcentric/aem-classification</url>
        <tag>aem-classification-1.2.1</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-central-portal</id>
            <name>AEM Classification Snapshots</name>
            <url>https://central.sonatype.com/repository/maven-snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-central-portal</id>
            <name>AEM Classification Releases</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
    </distributionManagement>

    <properties>
        <maven.version>3.9</maven.version>
        <maven.compiler.release>8</maven.compiler.release> <!-- used for compiler and javadoc plugin -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.jupiter.version>5.9.0</junit.jupiter.version>
        <njord.version>0.8.7</njord.version>
        <!-- https://maveniverse.eu/docs/njord/configuration/#global-properties -->
        <njord.releaseUrl>njord:template:release-sca</njord.releaseUrl>
        <njord.snapshotUrl>njord:template:snapshot</njord.snapshotUrl>
        <njord.publisher>sonatype-cp</njord.publisher>
        <njord.autoPublish>true</njord.autoPublish>
        <njord.publishingType>automatic</njord.publishingType>
        <njord.waitForStates>true</njord.waitForStates>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>23.0.0</version>
            </dependency>
            <!-- TESTING -->
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>6.0.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <extensions>
            <extension>
                <groupId>eu.maveniverse.maven.njord</groupId>
                <artifactId>extension3</artifactId>
                <version>${njord.version}</version>
            </extension>
        </extensions>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>eu.maveniverse.maven.plugins</groupId>
                    <artifactId>njord</artifactId>
                    <version>${njord.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.4</version>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.4</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.4.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.12.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.4.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>3.15.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-plugin-report-plugin</artifactId>
                    <version>3.15.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.9.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.9.0</version>
                </plugin>
                <!-- ====================================================================== -->
                <!-- S I T E P L U G I N -->
                <!-- ====================================================================== -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.21.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-scm-publish-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.6.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.2.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.jackrabbit</groupId>
                    <artifactId>filevault-package-maven-plugin</artifactId>
                    <version>1.4.0</version>
                </plugin>
                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <version>1.0.6</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>2.7.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>1.7.3</version>
                    <configuration>
                        <flattenMode>ossrh</flattenMode>
                    </configuration>
                    <executions>
                        <!-- enable flattening -->
                        <execution>
                            <id>flatten</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>flatten</goal>
                            </goals>
                        </execution>
                        <!-- ensure proper cleanup -->
                        <execution>
                            <id>flatten.clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>21</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>${maven.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- always generate javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-javadoc</id>
                        <goals>
                            <goal>javadoc</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                    <tagNameFormat>@{project.artifactId}-@{project.version}</tagNameFormat>
                    <!-- skip rebuilding the release with GitHub actions (https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/) -->
                    <scmReleaseCommitComment>@{prefix} prepare release @{releaseLabel} [skip ci]</scmReleaseCommitComment>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <licenseName>epl_only_v1</licenseName>
                    <excludes>test/resources/**</excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>run-license-check</id>
                        <goals>
                            <goal>check-file-header</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <failOnMissingHeader>true</failOnMissingHeader>
                            <failOnNotUptodateHeader>true</failOnNotUptodateHeader>
                            <ignoreNoFileToScan>true</ignoreNoFileToScan>
                            <verbose>true</verbose>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                </property>
            </activation>
            <build>
                <!-- https://central.sonatype.org/pages/requirements.html -->
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverage-report</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.14</version>
                        <executions>
                            <execution>
                                <id>prepare-jacoco-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>jacoco-report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>all</id>
            <modules>
                <!-- also build modules released separately and containing only config -->
                <module>aem-classification-search-index-package</module>
                <module>aem-classification-maps</module>
            </modules>
        </profile>
    </profiles>
    <modules>
        <module>aem-classification-validator</module>
        <module>aem-classification-maven-plugin</module>
    </modules>
</project>
