<?xml version="1.0" encoding="utf-8" ?>
<!--
 - Copyright (C) 2023 Connectorio Sp. z o.o.
 -
 - Licensed under the Apache License, Version 2.0 (the "License");
 - you may not use this file except in compliance with the License.
 - You may obtain a copy of the License at
 -
 -     http://www.apache.org/licenses/LICENSE-2.0
 -
 - Unless required by applicable law or agreed to in writing, software
 - distributed under the License is distributed on an "AS IS" BASIS,
 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 - See the License for the specific language governing permissions and
 - limitations under the License.
 -->
<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">

  <!-- Maven model version - the version 4.0.0 is reserved for Maven 2.x+ -->
  <modelVersion>4.0.0</modelVersion>

  <!-- Project identification -->
  <groupId>org.thing4</groupId>
  <artifactId>parent</artifactId>
  <version>5</version>

  <name>Thing4 | Parent</name>
  <packaging>pom</packaging>

  <!-- Information about project -->
  <description>Parent project components developed by Thing4.</description>

  <url>http://thing4.org</url>

  <inceptionYear>2023</inceptionYear>

  <!-- Issue tracker -->
  <issueManagement>
    <system>Github</system>
    <url>https://github.com/thingfour/parent</url>
  </issueManagement>

  <organization>
    <name>Thing4</name>
    <url>http://thing4.org</url>
  </organization>

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

  <scm>
    <connection>scm:git:git@github.com:thingfour/parent.git</connection>
    <developerConnection>scm:git:git@github.com:thingfour/parent.git</developerConnection>
    <url>https://github.com/thingfour/parent</url>
    <tag>5</tag>
  </scm>

  <!-- properties -->
  <properties>
    <!-- Maven plugins -->
    <maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
    <maven-clean-plugin.version>3.3.2</maven-clean-plugin.version>
    <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
    <maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>
    <maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
    <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
    <maven-install-plugin.version>3.1.1</maven-install-plugin.version>
    <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
    <maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
    <maven-jxr-plugin.version>3.3.2</maven-jxr-plugin.version>
    <maven-release-plugin.version>3.0.1</maven-release-plugin.version>
    <maven-reports-plugin.version>3.5.0</maven-reports-plugin.version>
    <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
    <maven-site-plugin.version>4.0.0-M13</maven-site-plugin.version>
    <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
    <maven-source-plugin.version>3.3.0</maven-source-plugin.version>

    <mojohaus-buildhelper-plugin.version>3.5.0</mojohaus-buildhelper-plugin.version>

    <!-- Compilation -->
    <compiler.source>11</compiler.source>
    <compiler.target>11</compiler.target>

    <!-- Build and raporting plugin properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <snapshot.repository-id>thing4-snapshots</snapshot.repository-id>
    <snapshot.repository-name>Thing4 Snapshots</snapshot.repository-name>
    <snapshot.repository-url>https://repository.connectorio.cloud/repository/thing4-snapshots/</snapshot.repository-url>

    <release.repository-id>sonatype-nexus-staging-s01</release.repository-id>
    <release.repository-name>Sonatype Central Synchronisation (S01)</release.repository-name>
    <release.repository-url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</release.repository-url>

    <site.repository-id>github.com</site.repository-id>
    <site.repository-name>GitHub Pages</site.repository-name>
    <site.repository-url>scm:git:git@github.com:thingfour/thingfour.github.io.git</site.repository-url>

    <maven-wagon.version>3.4.3</maven-wagon.version>
    <maven-scm.version>1.12.0</maven-scm.version>
    <maven-scm-publish-plugin.version>3.1.0</maven-scm-publish-plugin.version>
  </properties>

  <!-- Repositories -->
  <distributionManagement>
    <repository>
      <id>${release.repository-id}</id>
      <url>${release.repository-url}</url>
      <name>${release.repository-name}</name>
    </repository>
    <snapshotRepository>
      <id>${snapshot.repository-id}</id>
      <url>${snapshot.repository-url}</url>
      <name>${snapshot.repository-name}</name>
    </snapshotRepository>
    <site>
      <id>${site.repository-id}</id>
      <url>${site.repository-url}</url>
      <name>${site.repository-name}</name>
    </site>
  </distributionManagement>

  <developers>
    <developer>
      <id>splatch</id>
      <name>Łukasz Dywicki</name>
      <organization>Connectorio Sp. z o.o.</organization>
      <organizationUrl>http://connectorio.com</organizationUrl>
      <timezone>Europe/Warsaw</timezone>
    </developer>
  </developers>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-scm</artifactId>
        <version>${maven-wagon.version}</version>
      </extension>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-http</artifactId>
        <version>${maven-wagon.version}</version>
      </extension>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
        <version>${maven-wagon.version}</version>
      </extension>
      <extension>
        <groupId>org.apache.maven.scm</groupId>
        <artifactId>maven-scm-manager-plexus</artifactId>
        <version>${maven-scm.version}</version>
      </extension>
      <extension>
        <groupId>org.apache.maven.scm</groupId>
        <artifactId>maven-scm-provider-gitexe</artifactId>
        <version>${maven-scm.version}</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven-checkstyle-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven-clean-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven-deploy-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven-gpg-plugin.version}</version>
          <configuration>
            <gpgArguments>
              <arg>--digest-algo=SHA512</arg>
            </gpgArguments>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven-install-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven-resources-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven-site-plugin.version}</version>
          <configuration>
            <skipDeploy>true</skipDeploy>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-report-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${mojohaus-buildhelper-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${compiler.source}</source>
          <target>${compiler.target}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>package</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
            <configuration>
              <includePom>true</includePom>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <inputEncoding>${project.build.sourceEncoding}</inputEncoding>
          <outputEncoding>${project.build.sourceEncoding}</outputEncoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>${maven-reports-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <reportSets>
          <reportSet>
            <id>default</id>
            <inherited>true</inherited>
            <reports>
              <report>aggregate-no-fork</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>aggregate</id>
            <inherited>true</inherited>
            <reports>
              <report>aggregate-no-fork</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>${maven-jxr-plugin.version}</version>
        <reportSets>
          <reportSet>
            <id>aggregate</id>
            <inherited>false</inherited>
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>openhab</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <repositories>
        <repository>
          <id>openhab-release</id>
          <name>openhab-release</name>
          <url>https://openhab.jfrog.io/openhab/libs-release</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>openhab-snapshot</id>
          <name>openhab-snapshot</name>
          <url>https://openhab.jfrog.io/openhab/libs-snapshot</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>

      <pluginRepositories>
        <pluginRepository>
          <id>openhab-release</id>
          <name>openhab-releases</name>
          <url>https://openhab.jfrog.io/openhab/libs-release</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
        <pluginRepository>
          <id>openhab-snapshot</id>
          <name>openhab-snapshot</name>
          <url>https://openhab.jfrog.io/openhab/libs-snapshot</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

    <profile>
      <id>release</id>

      <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>
          <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>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-descriptor</id>
                <goals>
                  <goal>attach-descriptor</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <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>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>site</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <executions>
              <execution>
                <id>stage-for-scm-publish</id>
                <phase>post-site</phase>
                <goals>
                  <goal>stage</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-publish-plugin</artifactId>
            <version>${maven-scm-publish-plugin.version}</version>
            <configuration>
              <checkoutDirectory>${project.basedir}/github.com</checkoutDirectory>
              <checkinComment>Updated site for ${project.artifactId} to version ${project.version}</checkinComment>
              <content>target/staging</content>
              <pubScmUrl>${project.scm.developerConnection}</pubScmUrl>
              <scmBranch>master</scmBranch>
            </configuration>
            <executions>
              <execution>
                <id>scm-publish</id>
                <phase>site-deploy</phase>
                <goals>
                  <goal>publish-scm</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>thing4</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <repositories>
        <repository>
          <id>thing4-snapshots</id>
          <name>Thing4 snapshots</name>
          <url>https://repository.connectorio.cloud/repository/thing4-snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>thing4-snapshots</id>
          <name>Thing4 snapshots</name>
          <url>https://repository.connectorio.cloud/repository/thing4-snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

</project>