<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>

    <groupId>dev.openfeature</groupId>
    <artifactId>sdk</artifactId>
    <version>1.18.1</version> <!--x-release-please-version -->

    <properties>
        <toolchain.jdk.version>[17,)</toolchain.jdk.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
        <org.mockito.version>5.19.0</org.mockito.version>
        <!-- exclusion expression for e2e tests -->
        <testExclusions>**/e2e/*.java</testExclusions>
        <module-name>${project.groupId}.${project.artifactId}</module-name>
        <skip.tests>false</skip.tests>
        <!-- this will throw an error if we use wrong apis -->
        <maven.compiler.release>11</maven.compiler.release>
    </properties>

    <name>OpenFeature Java SDK</name>
    <description>This is the Java implementation of OpenFeature, a vendor-agnostic abstraction library for evaluating
        feature flags.
    </description>
    <url>https://openfeature.dev</url>
    <developers>
        <developer>
            <id>abrahms</id>
            <name>Justin Abrahms</name>
            <organization>eBay</organization>
            <url>https://justin.abrah.ms/</url>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/open-feature/java-sdk.git</connection>
        <developerConnection>scm:git:https://github.com/open-feature/java-sdk.git</developerConnection>
        <url>https://github.com/open-feature/java-sdk</url>
    </scm>

    <dependencies>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.40</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <!-- used so that lombok can generate suppressions for spotbugs. It needs to find it on the relevant classpath -->
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs</artifactId>
            <version>4.9.6</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.17</version>
        </dependency>

        <!-- test -->
        <dependency>
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit-junit5</artifactId>
            <version>1.4.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${org.mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.27.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-suite</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit-platform-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.simplify4u</groupId>
            <artifactId>slf4j2-mock</artifactId>
            <version>2.4.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.4.8-jre</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>4.3.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>1.37</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>dev.cel</groupId>
            <artifactId>cel</artifactId>
            <version>0.11.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.vmlens</groupId>
            <artifactId>api</artifactId>
            <version>1.2.13</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>

            <!-- Start mockito workaround -->
            <!-- https://github.com/mockito/mockito/issues/3121 -->
            <!-- These are transitive dependencies of mockito we are forcing -->
            <dependency>
                <groupId>net.bytebuddy</groupId>
                <artifactId>byte-buddy</artifactId>
                <version>1.17.7</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>net.bytebuddy</groupId>
                <artifactId>byte-buddy-agent</artifactId>
                <version>1.17.7</version>
                <scope>test</scope>
            </dependency>
            <!-- End mockito workaround-->

            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>2.20.0</version> <!-- Use the desired version -->
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-bom</artifactId>
                <version>7.28.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.13.4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-toolchains-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>select-jdk-toolchain</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-maven-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <projectType>library</projectType>
                    <schemaVersion>1.3</schemaVersion>
                    <includeBomSerialNumber>true</includeBomSerialNumber>
                    <includeCompileScope>true</includeCompileScope>
                    <includeProvidedScope>true</includeProvidedScope>
                    <includeRuntimeScope>true</includeRuntimeScope>
                    <includeSystemScope>true</includeSystemScope>
                    <includeTestScope>false</includeTestScope>
                    <includeLicenseText>false</includeLicenseText>
                    <outputFormat>all</outputFormat>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>makeAggregateBom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.14.0</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.4</version>
                <configuration>
                    <forkCount>1</forkCount>
                    <reuseForks>false</reuseForks>
                    <argLine>
                        ${surefireArgLine}
                        --add-opens java.base/java.util=ALL-UNNAMED
                        --add-opens java.base/java.lang=ALL-UNNAMED
                    </argLine>
                    <excludes>
                        <!-- tests to exclude -->
                        <exclude>${testExclusions}</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.5.4</version>
                <configuration>
                    <argLine>
                        ${surefireArgLine}
                    </argLine>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.4.2</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>${module-name}</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>codequality</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <!--<plugin>
                        <groupId>com.vmlens</groupId>
                        <artifactId>vmlens-maven-plugin</artifactId>
                        <version>1.2.14</version>
                        <executions>
                            <execution>
                                <id>test</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <failIfNoTests>true</failIfNoTests>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>-->
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>3.8.1</version>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>analyze</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <failOnWarning>true</failOnWarning>
                            <ignoredUnusedDeclaredDependencies>
                                <ignoredUnusedDeclaredDependency>com.github.spotbugs:*</ignoredUnusedDeclaredDependency>
                                <ignoredUnusedDeclaredDependency>org.junit*</ignoredUnusedDeclaredDependency>
                                <ignoredUnusedDeclaredDependency>com.tngtech.archunit*</ignoredUnusedDeclaredDependency>
                                <ignoredUnusedDeclaredDependency>org.simplify4u:slf4j2-mock*</ignoredUnusedDeclaredDependency>
                            </ignoredUnusedDeclaredDependencies>
                            <ignoredDependencies>
                                <ignoredDependency>com.google.guava*</ignoredDependency>
                                <ignoredDependency>io.cucumber*</ignoredDependency>
                                <ignoredDependency>org.junit*</ignoredDependency>
                                <ignoredDependency>com.tngtech.archunit*</ignoredDependency>
                                <ignoredDependency>com.google.code.findbugs*</ignoredDependency>
                                <ignoredDependency>com.github.spotbugs*</ignoredDependency>
                                <ignoredDependency>org.simplify4u:slf4j-mock-common:*</ignoredDependency>
                            </ignoredDependencies>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.13</version>

                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>

                                <configuration>
                                    <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                                    <propertyName>surefireArgLine</propertyName>
                                </configuration>
                            </execution>

                            <execution>
                                <id>report</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>

                                <configuration>
                                    <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                                </configuration>
                            </execution>

                            <execution>
                                <id>jacoco-check</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                                    <excludes>
                                        <exclude>dev/openfeature/sdk/exceptions/**</exclude>
                                    </excludes>

                                    <rules>
                                        <rule>
                                            <element>PACKAGE</element>
                                            <limits>
                                                <limit>
                                                    <counter>LINE</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>0.70</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                </configuration>
                            </execution>

                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <version>4.9.6.0</version>
                        <configuration>
                            <excludeFilterFile>spotbugs-exclusions.xml</excludeFilterFile>
                            <plugins>
                                <plugin>
                                    <groupId>com.h3xstream.findsecbugs</groupId>
                                    <artifactId>findsecbugs-plugin</artifactId>
                                    <version>1.14.0</version>
                                </plugin>
                            </plugins>
                        </configuration>
                        <dependencies>
                            <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
                            <dependency>
                                <groupId>com.github.spotbugs</groupId>
                                <artifactId>spotbugs</artifactId>
                                <version>4.9.6</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>run-spotbugs</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <version>3.6.0</version>
                        <configuration>
                            <configLocation>checkstyle.xml</configLocation>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <linkXRef>false</linkXRef>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.puppycrawl.tools</groupId>
                                <artifactId>checkstyle</artifactId>
                                <version>11.0.1</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>validate</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.diffplug.spotless</groupId>
                        <artifactId>spotless-maven-plugin</artifactId>
                        <version>2.46.1</version>
                        <configuration>
                            <!-- optional: limit format enforcement to just the files changed by this feature branch -->
                            <!--                <ratchetFrom>origin/main</ratchetFrom>-->
                            <formats>
                                <!-- you can define as many formats as you want, each is independent -->
                                <format>
                                    <!-- define the files to apply to -->
                                    <includes>
                                        <include>.gitattributes</include>
                                        <include>.gitignore</include>
                                    </includes>
                                    <!-- define the steps to apply to those files -->
                                    <trimTrailingWhitespace/>
                                    <endWithNewline/>
                                    <indent>
                                        <spaces>true</spaces>
                                        <spacesPerTab>4</spacesPerTab>
                                    </indent>
                                </format>
                            </formats>
                            <!-- define a language-specific format -->
                            <java>
                                <palantirJavaFormat/>

                                <indent>
                                    <spaces>true</spaces>
                                    <spacesPerTab>4</spacesPerTab>
                                </indent>
                                <importOrder/>

                                <removeUnusedImports/>
                                <formatAnnotations/>

                            </java>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Begin source & javadocs being generated -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.11.3</version>
                        <configuration>
                            <failOnWarnings>true</failOnWarnings>
                            <doclint>all,-missing
                            </doclint> <!-- ignore missing javadoc, these are enforced with more customizability in the checkstyle plugin -->
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- end source & javadoc -->
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>

                <plugins>
                    <!-- Begin publish to maven central -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.8.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                    <!-- End publish to maven central -->

                    <!-- sign the jars -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- end sign -->
                </plugins>
            </build>
        </profile>

        <profile>
            <id>benchmark</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>pw.krejci</groupId>
                        <artifactId>jmh-maven-plugin</artifactId>
                        <version>0.2.2</version>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>e2e</id>
            <properties>
                <!-- run the e2e tests by clearing the exclusions -->
                <testExclusions/>
            </properties>
            <build>
                <plugins>
                    <!-- pull the gherkin tests as a git submodule  -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.5.1</version>
                        <executions>
                            <execution>
                                <id>update-test-harness-submodule</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <!-- run: git submodule update \-\-init \-\-recursive -->
                                    <executable>git</executable>
                                    <arguments>
                                        <argument>submodule</argument>
                                        <argument>update</argument>
                                        <argument>--init</argument>
                                        <argument>spec</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- profile for running tests under java 11 (used mostly in CI) -->
        <!-- selected automatically by JDK activation (see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#implicit-profile-activation) -->
        <profile>
            <id>java11</id>
            <!-- with the next block we can define a set of sdks which still support java 8, if any of the sdks is not supporting java 8 anymore -->
            <!--<modules><module></module></modules>-->
            <properties>
                <toolchain.jdk.version>[11,)</toolchain.jdk.version>
                <skip.tests>true</skip.tests>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-toolchains-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>select-jdk-toolchain</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.5.4</version>
                        <configuration>
                            <argLine>
                                ${surefireArgLine}
                            </argLine>
                            <excludes>
                                <!-- tests to exclude -->
                                <exclude>${testExclusions}</exclude>
                            </excludes>

                            <skipTests>${skip.tests}</skipTests>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>3.5.4</version>
                        <configuration>
                            <argLine>
                                ${surefireArgLine}
                            </argLine>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.14.0</version>
                        <executions>
                            <execution>
                                <id>default-testCompile</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                                <configuration>
                                    <skip>true</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

</project>
