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

  <groupId>cn.ponfee</groupId>
  <artifactId>disjob-parent</artifactId>
  <version>2.2.3</version>
  <packaging>pom</packaging>

  <name>${project.artifactId}</name>
  <description>A distributed job scheduling and distributed computing framework</description>
  <url>https://github.com/dromara/disjob</url>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Ponfee</name>
      <email>ponfee.cn@gmail.com</email>
      <organization>dromara</organization>
      <organizationUrl>https://dromara.org/</organizationUrl>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/dromara/disjob.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/dromara/disjob.git</developerConnection>
    <url>https://github.com/dromara/disjob</url>
    <tag>HEAD</tag>
  </scm>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/dromara/disjob/issues</url>
  </issueManagement>

  <modules>
    <module>disjob-common</module>
    <module>disjob-core</module>
    <module>disjob-id</module>
    <module>disjob-test</module>
    <module>disjob-registry</module>
    <module>disjob-alert</module>
    <module>disjob-supervisor</module>
    <module>disjob-worker</module>
    <module>disjob-bom</module>
    <module>disjob-reports</module>
  </modules>

  <properties>
    <revision>2.2.3</revision>

    <file.encoding>UTF-8</file.encoding>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>${file.encoding}</project.build.sourceEncoding>
    <project.reporting.outputEncoding>${file.encoding}</project.reporting.outputEncoding>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <basicArgLine>-Dfile.encoding=${file.encoding} -Djava.net.preferIPv4Stack=true</basicArgLine>
    <moduleExportsArgLine />

    <spring-boot.version>2.7.18</spring-boot.version>
    <mapstruct.version>1.6.3</mapstruct.version>
    <guava.version>33.5.0-jre</guava.version>
    <commons-collections4.version>4.5.0</commons-collections4.version>
    <commons-io.version>2.21.0</commons-io.version>
    <mybatis-spring-boot-starter.version>2.3.2</mybatis-spring-boot-starter.version>
    <curator-framework.version>5.9.0</curator-framework.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Exclude logback, empty dependency -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Help for compile：需要注意以下几个processor的定义顺序，否则需要使用annotationProcessorPaths指定 -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- Generate implementation class for annotated mapstruct @Mapper interface -->
    <dependency>
      <groupId>org.mapstruct</groupId>
      <artifactId>mapstruct-processor</artifactId>
      <version>${mapstruct.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-suite</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.skyscreamer</groupId>
      <artifactId>jsonassert</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>module-exports</id>
      <activation>
        <!-- 从JDK 9开始，Java版本号不再使用 1.x 的方式命名，而是直接使用 x 的方式命名 -->
        <jdk>[9,)</jdk>
      </activation>
      <properties>
        <!-- 多个`add-exports/add-opens`需要拆为多个`compiler arg`: https://zhuanlan.zhihu.com/p/640217638 -->
        <moduleExportsArgLine>--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED</moduleExportsArgLine>
      </properties>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>verify</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.4.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <doclint>none</doclint>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.8</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.10.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <finalName>${project.artifactId}-${project.version}</finalName>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.14</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <!-- https://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
        <version>1.7.3</version>
        <configuration>
          <updatePomFile>true</updatePomFile>
          <flattenMode>resolveCiFriendliesOnly</flattenMode>
          <outputDirectory>target</outputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>flatten.process-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>flatten</goal>
            </goals>
          </execution>
          <execution>
            <id>flatten.clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
        <configuration>
          <encoding>${file.encoding}</encoding>
          <source>${java.version}</source>
          <target>${java.version}</target>
          <compilerArgs>
            <arg>-parameters</arg>
            <arg>${moduleExportsArgLine}</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>jacoco-prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <propertyName>jacocoArgLine</propertyName>
            </configuration>
          </execution>
          <execution>
            <id>jacoco-report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
          <printSummary>true</printSummary>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <forkCount>1</forkCount>
          <reuseForks>true</reuseForks>
          <argLine>${basicArgLine} ${moduleExportsArgLine} ${jacocoArgLine}</argLine>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
