<?xml version="1.0" encoding="UTF-8"?>
<!-- (C) Copyright 2015 Netcentric AG. All rights reserved. This program
    and the accompanying materials are made available under the terms of the
    Eclipse Public License v1.0 which accompanies this distribution, and is available
    at http://www.eclipse.org/legal/epl-v10.html -->
<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>
    <!-- ====================================================================== -->
    <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->

    <groupId>biz.netcentric.cq.tools.accesscontroltool</groupId>
    <artifactId>accesscontroltool</artifactId>
    <version>3.0.2</version>
    <packaging>pom</packaging>

    <name>Access Control Tool</name>
    <description>Maven Multimodule project for Access Control Tool.</description>
    <url>https://github.com/Netcentric/accesscontroltool</url>
    <organization>
        <name>Netcentric - A Cognizant Digital Business</name>
        <url>https://www.netcentric.biz/</url>
    </organization>
    <developers>
        <developer>
            <name>Georg Henzler</name>
            <email>georg.henzler@netcentric.biz</email>
            <id>georg.henzler@netcentric.biz</id>
            <organization>Netcentric</organization>
            <organizationUrl>https://www.netcentric.biz/</organizationUrl>
        </developer>
        <developer>
            <name>Konrad Windszus</name>
            <email>konrad.windszus@netcentric.biz</email>
            <id>konrad.windszus@netcentric.biz</id>
            <organization>Netcentric</organization>
            <organizationUrl>https://www.netcentric.biz/</organizationUrl>
        </developer>
    </developers>
    <ciManagement>
        <system>github</system>
        <url>https://github.com/Netcentric/accesscontroltool/actions/workflows/maven.yml</url>
    </ciManagement>
    <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>

    <scm>
        <connection>scm:git:ssh://git@github.com/Netcentric/accesscontroltool.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/Netcentric/accesscontroltool.git</developerConnection>
        <url>https://github.com/Netcentric/accesscontroltool.git</url>
        <tag>3.0.2</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <!-- ====================================================================== -->
    <!-- P R O P E R T I E S -->
    <!-- ====================================================================== -->
    <properties>
        <crx.host>localhost</crx.host>
        <crx.port>4502</crx.port>
        <crx.username>admin</crx.username>
        <crx.password>admin</crx.password>
        <publish.crx.host>localhost</publish.crx.host>
        <publish.crx.port>4503</publish.crx.port>
        <publish.crx.username>admin</publish.crx.username>
        <publish.crx.password>admin</publish.crx.password>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <slf4j.version>1.7.25</slf4j.version>
        <bnd.version>5.3.0</bnd.version>
        <bouncycastle.version>1.64</bouncycastle.version>
        <java.target.version>8</java.target.version>
    </properties>

    <modules>
        <module>target-osgi-environment</module>
        <module>accesscontroltool-bundle</module>
        <module>accesscontroltool-startuphook-bundle</module>
        <module>accesscontroltool-apps-package</module>
        <module>accesscontroltool-content-package</module>
        <module>accesscontroltool-package</module>
        <module>accesscontroltool-oakindex-package</module>
        <module>accesscontroltool-exampleconfig-package</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <!-- Runtime dependencies should be AEM 6.4 compatible -->
            <dependency>
                <groupId>io.wcm.maven</groupId>
                <artifactId>io.wcm.maven.aem-dependencies</artifactId>
                <version>6.4.0.0003</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- https://wcm-io.atlassian.net/browse/WTOOL-76 -->
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.service.url</artifactId>
                <version>1.0.1</version>
                <scope>provided</scope>
            </dependency>
            <!-- embedded 3rd party dependencies -->
            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>1.28</version>
            </dependency>
            <!-- due to https://bugs.openjdk.java.net/browse/JDK-8231581 OOTB JRE is not sufficient -->
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk15on</artifactId>
                <version>${bouncycastle.version}</version>
                <scope>provided</scope>
            </dependency>
            <!-- testing dependencies -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-core</artifactId>
                <version>2.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>2.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>3.10.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                    <configuration>
                        <bnd>
Bundle-DocURL: https://github.com/Netcentric/accesscontroltool
# generate error (instead of warning) when exported package uses private (non-exported) reference
-fixupmessages:"Export *,  has \\d+,  private references"; \
    restrict:=warning; \
    is:=error
                        </bnd>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>bnd-process</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-baseline-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                </plugin>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-resolver-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                    <configuration>
                        <trimStackTrace>false</trimStackTrace>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M3</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>maven-sling-plugin</artifactId>
                    <version>2.4.2</version>
                    <configuration>
                        <user>${crx.username}</user>
                        <password>${crx.password}</password>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>animal-sniffer-maven-plugin</artifactId>
                    <version>1.20</version>
                </plugin>
                <!-- for building content packages -->
                <plugin>
                    <groupId>org.apache.jackrabbit</groupId>
                    <artifactId>filevault-package-maven-plugin</artifactId>
                    <version>1.1.8</version>
                    <extensions>true</extensions>
                    <configuration>
                        <group>Netcentric</group>
                        <filterSource>src/main/META-INF/vault/filter.xml</filterSource>
                        <validatorsSettings>
                            <jackrabbit-filter>
                                <options>
                                    <validRoots>/,/libs,/libs/core/wcm,/apps,/apps/netcentric,/apps/netcentric/actool,/etc,/etc/packages,/tmp,/content,/oak:index</validRoots>
                                </options>
                            </jackrabbit-filter>
                            <jackrabbit-nodetypes>
                                <options>
                                    <!-- use the nodetypes and namespaces from the aem-nodetypes.jar provided in the plugin dependencies -->
                                    <cnds>tccl:aem.cnd</cnds>
                                </options>
                            </jackrabbit-nodetypes>
                            <netcentric-aem-classification>
                                <defaultSeverity>WARN</defaultSeverity>
                                <options>
                                    <severitiesPerClassification>INTERNAL_DEPRECATED=WARN</severitiesPerClassification>
                                    <maps>tccl:biz/netcentric/filevault/validator/maps/aem-classification-map-deprecations/coral2deprecations.map,tccl:biz/netcentric/filevault/validator/maps/aem-classification-map-deprecations/graniteuideprecations.map,tccl:biz/netcentric/filevault/validator/maps/aem-classification-map-repo-annotations.map</maps>
                                </options>
                            </netcentric-aem-classification>
                            <netcentric-aem-cloud>
                                <options>
                                    <allowVarNodeOutsideContainer>false</allowVarNodeOutsideContainer><!-- default value is true, as it is allowed to have /var nodes inside author-only container -->
                                </options>
                            </netcentric-aem-cloud>
                        </validatorsSettings>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.jackrabbit.vault</groupId>
                            <artifactId>org.apache.jackrabbit.vault</artifactId>
                            <version>3.5.0</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.jackrabbit.vault</groupId>
                            <artifactId>vault-validation</artifactId>
                            <version>3.5.0</version>
                        </dependency>
                        <dependency>
                            <groupId>biz.netcentric.filevault.validator</groupId>
                            <artifactId>aem-classification-validator</artifactId>
                            <version>1.0.0</version>
                        </dependency>
                        <!-- the dependency containing the actual classification map -->
                        <dependency>
                            <groupId>biz.netcentric.filevault.validator.maps</groupId>
                            <artifactId>aem-classification-map-repo-annotations</artifactId>
                            <version>6.5.3.0</version>
                        </dependency>
                        <dependency>
                            <groupId>biz.netcentric.filevault.validator.maps</groupId>
                            <artifactId>aem-classification-map-deprecations</artifactId>
                            <version>6.5.0.0</version>
                        </dependency>
                        <dependency>
                            <groupId>biz.netcentric.aem</groupId>
                            <artifactId>aem-nodetypes</artifactId>
                            <version>6.5.7.0</version>
                        </dependency>
                        <!-- https://github.com/Netcentric/aem-cloud-validator -->
                        <dependency>
                            <groupId>biz.netcentric.filevault.validator</groupId>
                            <artifactId>aem-cloud-validator</artifactId>
                            <version>1.2.0</version>
                        </dependency>
                        
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>osgicheck-maven-plugin</artifactId>
                    <version>0.1.0</version>
                    <executions>
                        <execution>
                            <id>check-bundle</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- for deploying to AEM -->
                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <version>1.0.4</version>
                    <configuration>
                        <failOnError>true</failOnError>
                        <userId>${crx.username}</userId>
                        <password>${crx.password}</password>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.adobe.aem</groupId>
                    <artifactId>aemanalyser-maven-plugin</artifactId>
                    <version>1.0.8</version>
                    <executions>
                        <execution>
                            <id>aem-analyser</id>
                            <goals>
                                <goal>project-analyse</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.0-M4</version>
                    <configuration>
                        <releaseProfiles>release</releaseProfiles>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <tagNameFormat>@{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>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven-and-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.0.2</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>1.8.0</version>
                                    <message>Bnd requires Java 8 (https://github.com/bndtools/bnd/wiki/Changes-in-4.0.0)</message>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- https://github.com/sonatype/nexus-maven-plugins/tree/master/staging/maven-plugin -->
            <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>
                    <stagingProgressTimeoutMinutes>20</stagingProgressTimeoutMinutes>
                    <keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>animal-sniffer-maven-plugin</artifactId>
                        <version>1.20</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <signature>
                                <groupId>org.codehaus.mojo.signature</groupId>
                                <artifactId>java18</artifactId>
                                <version>1.0</version>
                            </signature>
                        </configuration>
                     </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jdk9-or-higher</id>
            <activation>
                <!-- syntax according to http://maven.apache.org/enforcer/enforcer-rules/versionRanges.html -->
                <jdk>[9,)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <!-- 
                            release sets API classpath, source and target, see 
                            https://docs.oracle.com/javase/9/tools/javac.htm#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-D343F6B4-3FDD-43A8-AD24-43DD70214471 
                            and http://openjdk.java.net/jeps/247 -->
                            <release>${java.target.version}</release>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>autoInstallBundle</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>maven-sling-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-bundle</id>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <slingUrl>http://${crx.host}:${crx.port}/apps/netcentric/actool/install</slingUrl>
                            <usePut>true</usePut>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dependency-check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>6.2.0</version>
                        <executions>
                            <execution>
                                <id>check-dependencies-for-vulnerabilities</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <cveValidForHours>24</cveValidForHours>
                            <failBuildOnAnyVulnerability>true</failBuildOnAnyVulnerability>
                            <skipProvidedScope>true</skipProvidedScope>
                            <skipSystemScope>true</skipSystemScope>
                            <retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
                            <skip>true</skip><!-- only enable in specific submodules -->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverage-report</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.7</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>
    </profiles>

</project>
