<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2022 Red Hat, Inc.

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

  <parent>
    <groupId>org.jboss</groupId>
    <artifactId>jboss-parent</artifactId>
    <version>53</version>
  </parent>

  <groupId>org.jboss.pnc.otel</groupId>
  <artifactId>opentelemetry-ext-cli-java</artifactId>
  <version>2.0.0</version>

  <name>opentelemetry-ext-cli-java</name>

  <description>Opentelemetry CLI Extension for Java</description>
  <url>https://github.com/project-ncl/opentelemetry-ext-cli-java</url>
  <inceptionYear>2022</inceptionYear>

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

  <developers>
    <developer>
      <id>Red Hat, Inc.</id>
      <name>Red Hat, Inc.</name>
      <organization>Red Hat, Inc.</organization>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/project-ncl/opentelemetry-ext-cli-java.git</connection>
    <developerConnection>scm:git:git@github.com:project-ncl/opentelemetry-ext-cli-java.git</developerConnection>
    <tag>v2.0.0</tag>
    <url>https://github.com/project-ncl/opentelemetry-ext-cli-java</url>
  </scm>

  <properties>
    <javaVersion>1.8</javaVersion>
    <!-- Override jboss-parent compiler settings to match project requirements -->
    <maven.compiler.source>${javaVersion}</maven.compiler.source>
    <maven.compiler.target>${javaVersion}</maven.compiler.target>
    <maven.compiler.testTarget>${javaVersion}</maven.compiler.testTarget>
    <maven.compiler.testSource>${javaVersion}</maven.compiler.testSource>
    <maven.compiler.release>8</maven.compiler.release>
    <maven.compiler.testRelease>8</maven.compiler.testRelease>

    <!-- Override enforcer requirements -->
    <jdk.min.version>11</jdk.min.version>

    <slf4j.version>2.0.17</slf4j.version>
    <!--
    The Quarkus BOM brings in its own versions of okhttp3 (3.14.9) and okio (1.17.2) and kotlin (1.7.22).
    This conflicts with the OpenTelemetry versions. We can't update to 1.52/1.53 as it causes major conflicts
    in Kotlin when building with Gradle (Protocol message contained an invalid tag (zero))
    1.53 : okhttp 5.1.0 ( okio 3.15.0, kotlin-stdlib 2.2.0)
    1.52 : okhttp 5.1.0 ( okio 3.15.0, kotlin-stdlib 2.2.0)
    1.51 : okhttp 4.12.0 ( okio 3.6.0, kotlin-stdlib 1.8.21)
    1.40 : okhttp 4.12.0 ( okio 3.6.0, kotlin-stdlib 1.8.21)
    1.29 : okhttp 4.11.0 ( okio 3.2.0, kotlin-stdlib 1.6.20)
    -->
    <otel.version>1.51.0</otel.version>
    <quarkus.version>2.16.12.Final</quarkus.version>

    <tagNameFormat>v@{project.version}</tagNameFormat>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- OpenTelemetry. Alpha BOM includes stable BOM -->
      <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-bom-alpha</artifactId>
        <version>${otel.version}-alpha</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>4.12.0</version>
      </dependency>
      <dependency>
        <groupId>com.squareup.okio</groupId>
        <artifactId>okio</artifactId>
        <version>3.6.0</version>
      </dependency>
      <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-semconv</artifactId>
        <version>1.29.0-alpha</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>io.quarkus.platform</groupId>
        <artifactId>quarkus-bom</artifactId>
        <version>2.16.12.Final</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.44</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>${slf4j.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>uk.org.webcompere</groupId>
        <artifactId>system-stubs-core</artifactId>
        <version>2.1.8</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-api</artifactId>
    </dependency>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-sdk</artifactId>
    </dependency>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-semconv</artifactId>
    </dependency>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-exporter-otlp</artifactId>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>uk.org.webcompere</groupId>
      <artifactId>system-stubs-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-mutiny</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-opentelemetry</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>5.0.0</version>
          <configuration>
            <properties>
              <owner>Red Hat, Inc.</owner>
            </properties>
            <licenseSets>
              <licenseSet>
                <header>com/mycila/maven/plugin/license/templates/APACHE-2-noemail.txt</header>
              </licenseSet>
            </licenseSets>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <executions>
            <execution>
              <id>default-test</id>
              <configuration>
                <systemPropertyVariables>
                  <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                  <maven.home>${maven.home}</maven.home>
                </systemPropertyVariables>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>3.4.0</version>
        <configuration>
          <pom>
            <sortPom>
              <expandEmptyElements>false</expandEmptyElements>
            </sortPom>
          </pom>
          <java>
            <removeUnusedImports/>
            <importOrder>
              <file>java-import-order.txt</file>
            </importOrder>
            <eclipse>
              <file>java-formatter.xml</file>
            </eclipse>
            <lineEndings>UNIX</lineEndings>
          </java>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>ide-config</artifactId>
            <version>1.1.0</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <goals>
              <goal>apply</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
