<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2016 Contributors to the Eclipse Foundation

    See the NOTICE file(s) distributed with this work for additional
    information regarding copyright ownership.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License 2.0 which is available at
    http://www.eclipse.org/legal/epl-2.0

    SPDX-License-Identifier: EPL-2.0
 -->
<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"
  child.project.url.inherit.append.path="false">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.eclipse.hono</groupId>
  <artifactId>hono-parent</artifactId>
  <version>2.7.0</version>
  <packaging>pom</packaging>

  <name>Hono</name>
  <description>
    Eclipse Hono provides remote service interfaces for connecting large numbers of IoT devices to a back end and
    interacting with them in a uniform way regardless of the device communication protocol.
  </description>
  <url>https://eclipse.dev/hono</url>
  <inceptionYear>2016</inceptionYear>

  <organization>
    <name>Eclipse Foundation</name>
    <url>https://www.eclipse.org/</url>
  </organization>

  <licenses>
    <license>
      <name>EPL-2.0</name>
      <url>http://www.eclipse.org/legal/epl-2.0</url>
      <comments>Eclipse Public License - Version 2.0</comments>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <developerConnection>scm:git:https://github.com/eclipse-hono/hono.git</developerConnection>
    <url>https://github.com/eclipse-hono/hono</url>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/eclipse-hono/hono/issues</url>
  </issueManagement>

  <ciManagement>
    <system>GitHub Actions</system>
    <url>https://github.com/eclipse-hono/hono/actions</url>
  </ciManagement>

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

  <developers>
    <developer>
      <id>khudalla</id>
      <name>Kai Hudalla</name>
      <email>sophokles.kh@gmail.com</email>
      <url>https://github.com/sophokles73</url>
      <roles>
        <role>Lead</role>
        <role>Committer</role>
      </roles>
    </developer>
    <developer>
      <id>dbosanac</id>
      <name>Dejan Bosanac</name>
      <email>dejan@sensatic.net</email>
      <roles>
        <role>Lead</role>
        <role>Committer</role>
      </roles>
    </developer>
    <developer>
      <id>calohmn</id>
      <name>Carsten Lohmann</name>
      <email>carsten.lohmann@bosch.com</email>
      <organization>Robert Bosch GmbH</organization>
      <organizationUrl>https://www.bosch-digital.com</organizationUrl>
      <roles>
        <role>Committer</role>
      </roles>
    </developer>
    <developer>
      <id>mattkaem</id>
      <name>Matthias Kämmer</name>
      <email>m.kaemmer@sotec.eu</email>
      <organization>SOTEC GmbH &amp; Co KG</organization>
      <organizationUrl>https://www.sotec.eu</organizationUrl>
      <roles>
        <role>Committer</role>
      </roles>
    </developer>
  </developers>

  <properties>
    <run-java-sh.version>1.3.8</run-java-sh.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <version.njord>0.9.3</version.njord>
    <maven.compiler.release>17</maven.compiler.release>

    <!--
      during development we allow dependencies on SNAPSHOT versions,
      when doing a release build, set this property to false.
     -->
    <snapshotDependencyAllowed>true</snapshotDependencyAllowed>

    <!--
      Needs to be set to true on platforms where no Docker daemon is available.
    -->
    <skipDockerTests>${skipTests}</skipDockerTests>

    <!--
      The organization name to use for our Docker image names.
     -->
    <docker.image.org-name>eclipsehono</docker.image.org-name>

    <!--
      The Docker registry to use for our Docker image names.
    -->
    <docker.registry-name>docker.io</docker.registry-name>

    <!--
      The Docker repository to use for our Docker image names.
    -->
    <docker.repository>${docker.registry-name}/${docker.image.org-name}</docker.repository>

    <!--
      Additional tag which can be defined for custom builds
     -->
    <docker.image.additional.tag></docker.image.additional.tag>

    <!-- 
      By default, do not push container images to registry.
     -->
    <docker.skip.push>true</docker.skip.push>

    <!-- skip acquisition of code coverage information when running unit tests by default -->
    <jacoco.skip>true</jacoco.skip>
  </properties>

  <modules>
    <module>adapter-base</module>
    <module>adapters</module>
    <module>bom</module>
    <module>core</module>
    <module>cli</module>
    <module>client-device-connection-base</module>
    <module>client-device-connection-infinispan</module>
    <module>clients</module>
    <module>demo-certs</module>
    <module>examples</module>
    <module>legal</module>
    <module>service-base</module>
    <module>services</module>
    <module>site</module>
    <module>test-utils</module>
    <module>tests</module>
  </modules>

  <build>
    <extensions>
      <extension>
        <groupId>eu.maveniverse.maven.njord</groupId>
        <artifactId>extension3</artifactId>
        <version>${version.njord}</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>eu.maveniverse.maven.plugins</groupId>
          <artifactId>njord</artifactId>
          <version>${version.njord}</version>
        </plugin>
        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>docker-maven-plugin</artifactId>
          <version>0.48.0</version>
          <executions>
            <execution>
              <id>build_images</id>
              <phase>package</phase>
              <goals>
                <goal>build</goal>
              </goals>
            </execution>
            <execution>
              <id>push_image</id>
              <phase>install</phase>
              <goals>
                <goal>push</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>io.fabric8</groupId>
              <artifactId>run-java-sh</artifactId>
              <version>${run-java-sh.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <images>
              <image>
                <name>${docker.repository}/%a:%v</name>
                <build>
                  <maintainer>The Eclipse Hono project</maintainer>
                  <labels>
                    <project>Eclipse Hono</project>
                  </labels>
                  <tags>
                    <tag>${docker.image.additional.tag}</tag>
                  </tags>
                  <imagePullPolicy>Always</imagePullPolicy>
                  <from>${java-base-image.name}</from>
                </build>
              </image>
            </images>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.5.0</version>
          <configuration>
            <skipIfEmpty>true</skipIfEmpty>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.12.0</version>
          <configuration>
            <doclint>all,-accessibility</doclint>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.4</version>
          <configuration>
            <systemPropertyVariables>
              <!-- use Base64 encoder/decoder that is compatible with vert.x 3 -->
              <vertx.json.base64>legacy</vertx.json.base64>
              <hono.skipDockerTests>${skipDockerTests}</hono.skipDockerTests>
              <!-- use Docker Client API 1.44 to make sure we can run testcontainers based tests with Docker 29 -->
              <api.version>1.44</api.version>
            </systemPropertyVariables>
            <properties>
              <configurationParameters>
                junit.jupiter.execution.parallel.enabled = true
                junit.jupiter.execution.parallel.mode.default = same_thread
                junit.jupiter.execution.parallel.mode.classes.default = concurrent
              </configurationParameters>
            </properties>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.5.4</version>
          <configuration>
            <systemPropertyVariables>
              <!-- use Base64 encoder/decoder that is compatible with vert.x 3 -->
              <vertx.json.base64>legacy</vertx.json.base64>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <!--
            Copy legal documents from "legal" module to "target/classes" folder
            so that we make sure to include legal docs in all modules.
           -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.9.0</version>
          <executions>
            <execution>
              <id>copy_legal_docs</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>unpack-dependencies</goal>
              </goals>
              <configuration>
                <includeArtifactIds>hono-legal</includeArtifactIds>
                <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
                <includes>legal/**</includes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.6.0</version>
          <dependencies>
            <dependency>
              <groupId>org.eclipse.hono</groupId>
              <artifactId>hono-legal</artifactId>
              <version>${project.version}</version>
            </dependency>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>12.3.0</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <?m2e ignore?>
              <id>checkstyle-check</id>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <configLocation>checkstyle/default.xml</configLocation>
            <suppressionsLocation>checkstyle/suppressions.xml</suppressionsLocation>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>properties-maven-plugin</artifactId>
          <version>1.3.0</version>
        </plugin>
        <plugin>
          <groupId>io.smallrye</groupId>
          <artifactId>jandex-maven-plugin</artifactId>
          <version>3.5.3</version>
          <executions>
            <execution>
              <id>make-index</id>
              <goals>
                <goal>jandex</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.14</version>
          <executions>
            <execution>
              <id>default-prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>default-report</id>
              <goals>
                <goal>report</goal>
              </goals>
            </execution>
            <execution>
              <id>default_check</id>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <rules>
                  <rule>
                    <element>CLASS</element>
                    <excludes>
                      <exclude>*Test</exclude>
                      <exclude>*IT</exclude>
                    </excludes>
                  </rule>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.6.2</version>
        <executions>
          <execution>
            <!-- Make sure that only non-snapshot versions are used for the dependencies.
              Only active when property 'snapshotDependencyAllowed' is false. -->
            <id>enforce-no-snapshots</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <skip>${snapshotDependencyAllowed}</skip>
              <rules>
                <requireReleaseDeps>
                  <message>No dependencies on snapshots allowed!</message>
                </requireReleaseDeps>
                <requireReleaseVersion>
                  <message>Cannot release snapshot version!</message>
                </requireReleaseVersion>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>enforce-java-17</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>17</version>
                </requireJavaVersion>
                <dependencyConvergence />
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.4.0</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>no_docker</id>
      <activation>
        <property>
          <name>noDocker</name>
        </property>
      </activation>
      <properties>
        <!-- this will prevent (unit) tests from being run that require test containers -->
        <skipDockerTests>true</skipDockerTests>
      </properties>
    </profile>
    <profile>
      <id>create_gpg_signature</id>
      <activation>
        <property>
          <name>createGPGSignature</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.8</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!--
        This profile is activated by Eclipse IDE automatically.
       -->
      <id>eclipse-only</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <!--
                This plugin's configuration is used to store Eclipse m2e settings only.
                It has no influence on the Maven build itself.
              -->
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
                <configuration>
                  <lifecycleMappingMetadata>
                    <pluginExecutions>
                      <pluginExecution>
                        <!--
                          Disable unpack-dependencies goal in order to prevent the m2eclipse
                          error "Artifact has not been packaged yet..."
                        -->
                        <pluginExecutionFilter>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-dependency-plugin</artifactId>
                          <versionRange>[3,)</versionRange>
                          <goals>
                            <goal>unpack-dependencies</goal>
                          </goals>
                        </pluginExecutionFilter>
                        <action>
                          <ignore></ignore>
                        </action>
                      </pluginExecution>
                    </pluginExecutions>
                  </lifecycleMappingMetadata>
                </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!--
        this profile generates JavaDoc jar files
        sub-modules can set property maven.javadoc.skip=true in order to skip this
        (e.g., the tests, application and example modules, which do not require JavaDoc being generated)
      -->
      <id>javadoc</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <property>
          <name>createJavadoc</name>
        </property>
      </activation>
      <build>
        <plugins>
          <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>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>docker-push-image</id>
      <properties>
        <docker.skip.push>false</docker.skip.push>
      </properties>
    </profile>
    <profile>
      <id>docker-multiarch-build</id>
      <properties>
        <docker.buildx.builderName>maven</docker.buildx.builderName>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>io.fabric8</groupId>
              <artifactId>docker-maven-plugin</artifactId>
              <configuration>
                <images>
                  <image>
                    <build>
                      <buildx>
                        <builderName>${docker.buildx.builderName}</builderName>
                        <platforms>
                          <platform>linux/amd64</platform>
                          <platform>linux/arm64</platform>
                        </platforms>
                      </buildx>
                    </build>
                  </image>
                </images>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>
