<project
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0"
    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>io.dapr</groupId>
    <artifactId>dapr-sdk-parent</artifactId>
    <version>1.16.0</version>
  </parent>

  <groupId>io.dapr.spring</groupId>
  <artifactId>dapr-spring-parent</artifactId>
  <packaging>pom</packaging>
  <version>1.16.0</version>
  <name>dapr-spring-parent</name>
  <description>SDK extension for Spring and Spring Boot</description>

  <modules>
    <module>dapr-spring-data</module>
    <module>dapr-spring-messaging</module>
    <module>dapr-spring-workflows</module>
    <module>dapr-spring-boot-autoconfigure</module>
    <module>dapr-spring-boot-tests</module>
    <module>dapr-spring-boot-starters/dapr-spring-boot-starter</module>
    <module>dapr-spring-boot-starters/dapr-spring-boot-starter-test</module>
  </modules>

  <properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <maven.compiler.release>11</maven.compiler.release>
    <testcontainers.version>1.19.8</testcontainers.version>
    <junit.version>5.11.2</junit.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${springboot.version}</version>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>io.dapr</groupId>
        <artifactId>dapr-sdk</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr</groupId>
        <artifactId>dapr-sdk-actors</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr</groupId>
        <artifactId>dapr-sdk-workflows</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr.spring</groupId>
        <artifactId>dapr-spring-data</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr.spring</groupId>
        <artifactId>dapr-spring-messaging</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr.spring</groupId>
        <artifactId>dapr-spring-workflows</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr.spring</groupId>
        <artifactId>dapr-spring-boot-autoconfigure</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr</groupId>
        <artifactId>dapr-sdk-springboot</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${springframework.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${springframework.version}</version>
      </dependency>

      <!-- Spring dependencies -->
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${springframework.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <version>${springboot.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <version>${springboot.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure-processor</artifactId>
        <version>${springboot.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dapr.spring</groupId>
        <artifactId>dapr-spring-boot-tests</artifactId>
        <version>${dapr.sdk.version}</version>
      </dependency>

      <!-- Test dependencies -->
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${springboot.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${testcontainers.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
      </plugin>
      <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.2.0</version>
        <configuration>
          <notimestamp>true</notimestamp>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.12</version>
        <executions>
          <execution>
            <id>default-prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <outputDirectory>target/jacoco-report/</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <rules>
                <rule>
                  <element>BUNDLE</element>
                  <includes>
                    <include>io.dapr.springboot.DaprBeanPostProcessor</include>
                  </includes>
                  <limits>
                    <limit>
                      <counter>LINE</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>80%</minimum>
                    </limit>
                  </limits>
                </rule>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
