<?xml version="1.0" encoding="UTF-8"?>
<!--
 - Copyright (C) 2023-2024 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.
 -
 - SPDX-License-Identifier: Apache-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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.thing4</groupId>
    <artifactId>thing4</artifactId>
    <version>3.0.0-alpha-4</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>thing4-parent</artifactId>
  <packaging>pom</packaging>

  <name>Thing4 - Parent</name>
  <description>Parent for Thing4 tools, addons and extensions.</description>

  <properties>
    <compiler.source>11</compiler.source>
    <compiler.target>11</compiler.target>

    <bom.version>3.0.4</bom.version>
    <openhab.version>3.0.4</openhab.version>
    <openhab-distro.version>3.0.4</openhab-distro.version>

    <karaf.version>4.4.4</karaf.version>

    <slf4j.version>1.7.36</slf4j.version>
    <fasterxml-classmate.version>1.5.1</fasterxml-classmate.version>
    <osgi.version>6.0.0</osgi.version>

    <assertj.version>3.23.1</assertj.version>
    <junit-jupiter.version>5.9.1</junit-jupiter.version>
    <mockito.version>4.9.0</mockito.version>

    <!-- various build related variables -->
    <feature.file>${project.basedir}/target/feature/feature.xml</feature.file>
    <osgi.version>6.0.0</osgi.version>

    <connectorio-testcontainers.version>0.1.0</connectorio-testcontainers.version>
    <testcontainers.version>1.17.6</testcontainers.version>
    <antlr4.version>4.13.1</antlr4.version>
    <xtext.version>2.23.0</xtext.version>

    <plexus-component-annotations.version>1.7.1</plexus-component-annotations.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.service.component.annotations</artifactId>
        <version>1.4.0</version>
      </dependency>
      <dependency>
        <groupId>org.thing4.openhab.bom.generated</groupId>
        <artifactId>org.openhab.core.bom.compile</artifactId>
        <version>${bom.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.thing4.openhab.bom.generated</groupId>
        <artifactId>org.openhab.core.bom.compile-model</artifactId>
        <version>${bom.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.thing4.openhab.bom.generated</groupId>
        <artifactId>org.openhab.core.bom.openhab-core</artifactId>
        <version>${bom.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.thing4.dependencies</groupId>
        <artifactId>org.thing4.dependencies.units</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.thing4.dependencies</groupId>
        <artifactId>org.thing4.dependencies.units-si</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.apache.karaf.features</groupId>
        <artifactId>org.apache.karaf.features.core</artifactId>
        <version>${karaf.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.karaf.kar</groupId>
        <artifactId>org.apache.karaf.kar.core</artifactId>
        <version>${karaf.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.karaf.features</groupId>
        <artifactId>framework</artifactId>
        <version>${karaf.version}</version>
        <type>kar</type>
        <optional>true</optional>
        <exclusions>
          <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-reload4j</artifactId>
        <version>${slf4j.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit-jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit-jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <version>${junit-jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.antlr</groupId>
        <artifactId>antlr4-runtime</artifactId>
        <version>${antlr4.version}</version>
      </dependency>

      <!-- tooling -->
      <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-component-annotations</artifactId>
        <version>${plexus-component-annotations.version}</version>
      </dependency>

      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${testcontainers.version}</version>
      </dependency>
      <dependency>
        <groupId>org.connectorio.testcontainers</groupId>
        <artifactId>karaf</artifactId>
        <version>${connectorio-testcontainers.version}</version>
      </dependency>
      <dependency>
        <groupId>org.connectorio.testcontainers</groupId>
        <artifactId>openhab</artifactId>
        <version>${connectorio-testcontainers.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.antlr</groupId>
          <artifactId>antlr4-maven-plugin</artifactId>
          <version>${antlr4.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>5.1.9</version>
          <inherited>true</inherited>
          <configuration>
            <instructions>
              <Git-SCM-SHA>$${githead}</Git-SCM-SHA>
              <_removeheaders>Include-Resource,Private-Package,Require-Capability,Provide-Capability,Bnd-LastModified</_removeheaders>
              <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
              <_noimportjava>true</_noimportjava>
            </instructions>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.3.0</version>
          <inherited>true</inherited>
          <executions>
            <execution>
              <id>attach-feature-xml</id>
              <goals>
                <goal>attach-artifact</goal>
              </goals>
              <configuration>
                <artifacts>
                  <artifact>
                    <file>${feature.file}</file>
                    <classifier>features</classifier>
                    <type>xml</type>
                  </artifact>
                </artifacts>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.karaf.tooling</groupId>
          <artifactId>karaf-maven-plugin</artifactId>
          <version>${karaf.version}</version>
          <extensions>true</extensions>
          <inherited>true</inherited>
          <configuration>
            <startLevel>80</startLevel>
            <enableGeneration>false</enableGeneration>
            <aggregateFeatures>false</aggregateFeatures>
            <checkDependencyChange>false</checkDependencyChange>
            <failOnDependencyChange>false</failOnDependencyChange>
            <logDependencyChanges>false</logDependencyChanges>
            <overwriteChangedDependencies>false</overwriteChangedDependencies>
          </configuration>
          <executions>
            <execution>
              <id>karaf-verification</id>
              <goals>
                <goal>verify</goal>
              </goals>
              <phase>verify</phase>
              <configuration>
                <descriptors combine.children="append">
                  <!-- Apache Karaf -->
                  <descriptor>mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features</descriptor>
                  <descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
                  <!-- Current feature under verification -->
                  <descriptor>file:${feature.file}</descriptor>
                </descriptors>
                <distribution>org.apache.karaf.features:framework</distribution>
                <javase>11</javase>
                <framework>
                  <feature>framework</feature>
                </framework>
                <features combine.children="override">
                  <feature>_none_</feature>
                </features>
                <verifyTransitive>false</verifyTransitive>
                <ignoreMissingConditions>true</ignoreMissingConditions>
                <fail>first</fail>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <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-deploy-plugin</artifactId>
        <version>3.0.0-M1</version>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.10</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>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M7</version>
        <configuration>
          <systemPropertyVariables>
            <openhab.version>${openhab-distro.version}</openhab.version>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>

</project>
