<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>dev.streamx</groupId>
  <artifactId>streamx-connector-aem-parent</artifactId>
  <version>0.0.8</version>
  <packaging>pom</packaging>

  <name>AEM Connector - Parent POM</name>
  <description>Bridge between AEM and StreamX</description>
  <url>${url}</url>
  <inceptionYear>2024</inceptionYear>

  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>streamx</id>
      <name>StreamX Team</name>
      <email>hello@streamx.dev</email>
    </developer>
  </developers>

  <modules>
    <module>connector</module>
    <module>blueprints</module>
    <module>cloud-pack</module>
  </modules>

  <properties>
    <url>https://github.com/streamx-dev/streamx-connector-aem</url>
    <aem.host>localhost</aem.host>
    <aem.port>4502</aem.port>
    <aem.publish.host>localhost</aem.publish.host>
    <aem.publish.port>4503</aem.publish.port>
    <sling.user>admin</sling.user>
    <sling.password>admin</sling.password>
    <vault.user>admin</vault.user>
    <vault.password>admin</vault.password>
    <bnd.version>6.4.0</bnd.version>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <streamx-connector-sling.version>0.2.5</streamx-connector-sling.version>
    <org.apache.sling.servlet-helpers.version>1.4.6</org.apache.sling.servlet-helpers.version>
    <junit-bom.version>5.10.2</junit-bom.version>
    <mockito-junit-jupiter.version>5.12.0</mockito-junit-jupiter.version>
    <io.wcm.testing.aem-mock.junit5.version>5.6.4</io.wcm.testing.aem-mock.junit5.version>
    <org.apache.sling.testing.sling-mock-oak.version>4.0.0-1.62.0
    </org.apache.sling.testing.sling-mock-oak.version>
    <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
  </properties>

  <repositories>
    <repository>
      <id>streamx-maven-snapshots</id>
      <url>artifactregistry://europe-west1-maven.pkg.dev/streamx-releases/streamx-maven-snapshots
      </url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>streamx-maven-public-releases</id>
      <url>
        artifactregistry://europe-west1-maven.pkg.dev/streamx-releases/streamx-maven-public-releases
      </url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <scm>
    <connection>scm:git:git@github.com:streamx-dev/streamx-connector-aem.git</connection>
    <developerConnection>scm:git:git@github.com:streamx-dev/streamx-connector-aem.git
    </developerConnection>
    <tag>HEAD</tag>
    <url>${url}</url>
  </scm>

  <build>
    <extensions>
      <extension>
        <groupId>com.google.cloud.artifactregistry</groupId>
        <artifactId>artifactregistry-maven-wagon</artifactId>
        <version>2.2.1</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.3.0</version>
          <configuration>
            <archive>
              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-maven-plugin</artifactId>
          <version>${bnd.version}</version>
          <executions>
            <execution>
              <id>bnd-process</id>
              <goals>
                <goal>bnd-process</goal>
              </goals>
              <configuration>
                <bnd><![CDATA[
                        Bundle-Category: streamx
                        Bundle-Developers: Dynamic Solutions sp. z o.o. sp. k.
                        Bundle-Description : ${Bundle-Name}
                        Bundle-Vendor: Dynamic Solutions sp. z o.o. sp. k.
                        Bundle-ClassPath: ., lib/org.apache.sling.servlet-helpers-1.4.6.jar
                        -exportcontents: ${removeall;${packages;VERSIONED};${packages;CONDITIONAL}}
                        -snapshot: SNAPSHOT
                        -noextraheaders: true
                        -includeresource: \
                          lib/org.apache.sling.servlet-helpers-${org.apache.sling.servlet-helpers.version}.jar=../lib/org.apache.sling.servlet-helpers-${org.apache.sling.servlet-helpers.version}.jar
                        # 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>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-baseline-maven-plugin</artifactId>
          <version>${bnd.version}</version>
          <configuration>
            <!-- Remove after first release. -->
            <failOnMissing>false</failOnMissing>
          </configuration>
          <executions>
            <execution>
              <id>baseline</id>
              <goals>
                <goal>baseline</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.sling</groupId>
          <artifactId>sling-maven-plugin</artifactId>
          <version>2.4.0</version>
          <configuration>
            <slingUrl>http://${aem.host}:${aem.port}/system/console</slingUrl>
            <deploymentMethod>WebConsole</deploymentMethod>
          </configuration>
        </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.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.1.1</version>
        <configuration>
          <tagNameFormat>@{project.version}</tagNameFormat>
          <scmCommentPrefix>[no ci] [maven-release-plugin]</scmCommentPrefix>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.3.9,)</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <message>Maven must be executed with a Java 11 JRE or higher.</message>
                  <version>11</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.11.2</version>
        <executions>
          <execution>
            <id>create-jar-archive-with-javadoc</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>autoInstallBundle</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.sling</groupId>
              <artifactId>sling-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>install-bundle</id>
                  <goals>
                    <goal>install</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>ossrhDeploy</id>
      <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>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.7.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>true</autoPublish>
              <waitUntil>published</waitUntil>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>streamxDeploy</id>
      <distributionManagement>
        <repository>
          <id>streamx-maven-public-releases</id>
          <url>
            artifactregistry://europe-west1-maven.pkg.dev/streamx-releases/streamx-maven-public-releases
          </url>
        </repository>
        <snapshotRepository>
          <id>streamx-maven-snapshots</id>
          <url>artifactregistry://europe-west1-maven.pkg.dev/streamx-releases/streamx-maven-snapshots
          </url>
        </snapshotRepository>
      </distributionManagement>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
      <!--AEM-->
      <dependency>
        <groupId>com.adobe.aem</groupId>
        <artifactId>uber-jar</artifactId>
        <version>6.5.22</version>
        <scope>provided</scope>
      </dependency>
      <!-- StreamX -->
      <dependency>
        <groupId>dev.streamx</groupId>
        <artifactId>streamx-connector-sling</artifactId>
        <version>${streamx-connector-sling.version}</version>
        <scope>provided</scope>
      </dependency>
      <!-- Sling -->
      <dependency>
        <groupId>org.apache.sling</groupId>
        <artifactId>org.apache.sling.servlet-helpers</artifactId>
        <version>${org.apache.sling.servlet-helpers.version}</version>
        <scope>provided</scope>
      </dependency>
      <!-- OSGi Metadata (not used in runtime)-->
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.service.metatype.annotations</artifactId>
        <version>1.4.1</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.service.component.annotations</artifactId>
        <version>1.4.0</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.service.component</artifactId>
        <version>1.5.1</version>
        <scope>provided</scope>
      </dependency>
      <!-- Miscellaneous -->
      <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.16.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.sling</groupId>
        <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
        <version>${org.apache.sling.testing.sling-mock-oak.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.testing.sling-mock.core</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit-bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${junit-bom.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito-junit-jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>io.wcm</groupId>
        <artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
        <version>${io.wcm.testing.aem-mock.junit5.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

</project>
