<?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">
  <packaging>pom</packaging>
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.prometheus</groupId>
    <artifactId>client_java_parent</artifactId>
    <version>1.3.8</version>
    <relativePath>prometheus-metrics-parent/pom.xml</relativePath>
  </parent>

  <version>1.3.8</version>
  <artifactId>client_java</artifactId>

  <name>Prometheus Metrics Library</name>
  <description>
    The Prometheus Java Metrics Library
  </description>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <automatic.module.name>--module-name-need-to-be-overridden--</automatic.module.name>
    <protobuf-java.version>4.31.0</protobuf-java.version>
    <guava.version>33.4.8-jre</guava.version>
    <junit-jupiter.version>5.12.2</junit-jupiter.version>
    <otel.instrumentation.version>2.16.0-alpha</otel.instrumentation.version>
    <java.version>8</java.version>
    <jacoco.line-coverage>0.70</jacoco.line-coverage>
    <checkstyle.skip>false</checkstyle.skip>
    <coverage.skip>false</coverage.skip>
    <spotless.skip>false</spotless.skip>
    <javadoc.skip>false</javadoc.skip>
    <warnings>-Werror</warnings>
  </properties>

  <modules>
    <module>prometheus-metrics-parent</module>
    <module>prometheus-metrics-bom</module>
    <module>prometheus-metrics-core</module>
    <module>prometheus-metrics-config</module>
    <module>prometheus-metrics-model</module>
    <module>prometheus-metrics-tracer</module>
    <module>prometheus-metrics-exposition-formats</module>
    <module>prometheus-metrics-exposition-formats-shaded</module>
    <module>prometheus-metrics-exposition-textformats</module>
    <module>prometheus-metrics-exporter-common</module>
    <module>prometheus-metrics-exporter-servlet-jakarta</module>
    <module>prometheus-metrics-exporter-servlet-javax</module>
    <module>prometheus-metrics-exporter-httpserver</module>
    <module>prometheus-metrics-exporter-opentelemetry</module>
    <module>prometheus-metrics-exporter-opentelemetry-shaded</module>
    <module>prometheus-metrics-exporter-opentelemetry-otel-agent-resources</module>
    <module>prometheus-metrics-exporter-pushgateway</module>
    <module>prometheus-metrics-instrumentation-caffeine</module>
    <module>prometheus-metrics-instrumentation-jvm</module>
    <module>prometheus-metrics-instrumentation-dropwizard5</module>
    <module>prometheus-metrics-instrumentation-dropwizard</module>
    <module>prometheus-metrics-instrumentation-guava</module>
    <module>prometheus-metrics-simpleclient-bridge</module>
  </modules>

  <dependencies>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>3.0.2</version>
      <scope>provided</scope>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</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.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>5.18.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.27.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>2.0.17</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit-pioneer</groupId>
      <artifactId>junit-pioneer</artifactId>
      <version>2.3.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <!-- Add plugin versions for reproducible builds. Versions for default bindings are taken from -->
        <!--https://github.com/apache/maven/tree/maven-3.8.1/maven-core/src/main/resources/META-INF/plexus-->
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.21.0</version>
        </plugin>
        <!-- Plugins with groupId org.apache.maven.plugins that are not part of default bindings. -->
        <plugin>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.5.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.8.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.11.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.6.0</version>
        <configuration>
          <consoleOutput>true</consoleOutput>
          <configLocation>google_checks.xml</configLocation>
          <configLocation>checkstyle.xml</configLocation>
          <violationSeverity>warning</violationSeverity>
          <failOnViolation>true</failOnViolation>
          <skip>${checkstyle.skip}</skip>
          <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
          <excludes>**/generated/**,**/jmh_generated/*</excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.13</version>
        <configuration>
          <skip>${coverage.skip}</skip>
          <excludes>
            <exclude>**/generated/**</exclude>
            <exclude>**/*BlockingRejectedExecutionHandler*</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <execution>
            <id>check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <rules>
                <rule>
                  <element>CLASS</element>
                  <limits>
                    <limit>
                      <counter>LINE</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${jacoco.line-coverage}</minimum>
                    </limit>
                  </limits>
                </rule>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-plugin-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requirePluginVersions>
                  <unCheckedPluginList>
                    org.springframework.boot:spring-boot-maven-plugin
                  </unCheckedPluginList>
                </requirePluginVersions>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>6.0.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <release>${java.version}</release>
          <source>${java.version}</source>
          <target>${java.version}</target>
          <testRelease>17</testRelease>
          <testSource>17</testSource>
          <testTarget>17</testTarget>
          <showWarnings>true</showWarnings>
          <compilerArgs>
            <arg>-Xlint:all,-serial,-processing,-options</arg>
            <arg>${warnings}</arg>
            <arg>--should-stop=ifError=FLOW</arg>
            <arg>-XDcompilePolicy=simple</arg>
            <arg>
              -Xplugin:ErrorProne
              -Xep:AlmostJavadoc:OFF
              -Xep:MissingSummary:OFF
              -Xep:LongDoubleConversion:OFF
              -Xep:StringSplitter:OFF
              -XepExcludedPaths:.*/generated/.*
            </arg>
          </compilerArgs>
          <annotationProcessorPaths>
            <path>
              <groupId>com.google.errorprone</groupId>
              <artifactId>error_prone_core</artifactId>
              <version>2.38.0</version>
            </path>
            <!-- Other annotation processors go here.

            If 'annotationProcessorPaths' is set, processors will no longer be
            discovered on the regular -classpath; see also 'Using Error Prone
            together with other annotation processors' below. -->
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>2.18.0</version>
        <configuration>
          <rulesUri>file://${project.basedir}/version-rules.xml</rulesUri>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <!-- maven-site-plugin 3.3 requires maven-project-info-reports-plugin < 3.0 -->
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.9.0</version>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <reportSets>
          <reportSet>
            <id>aggregate</id>
            <inherited>false</inherited>
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>default</id>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <modules>
        <module>examples</module>
        <module>benchmarks</module>
        <module>integration-tests</module>
      </modules>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.junit</groupId>
            <artifactId>junit-bom</artifactId>
            <version>${junit-jupiter.version}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </profile>
    <profile>
      <id>javadoc</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <encoding>UTF-8</encoding>
              <docencoding>UTF-8</docencoding>
              <linksource>true</linksource>
              <noqualifier>all</noqualifier>
              <show>public</show>
              <excludePackageNames>io.prometheus.metrics.expositionformats.generated.*
              </excludePackageNames>
              <source>8</source>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </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>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
