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

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You 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">
    <parent>
        <groupId>org.apache.seata</groupId>
        <artifactId>seata-build</artifactId>
        <version>${revision}</version>
        <relativePath>./build/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>seata-parent</artifactId>
    <packaging>pom</packaging>
    <name>Seata Parent POM ${project.version}</name>
    <description>parent for Seata built with Maven</description>

    <modules>
        <module>build</module>
        <module>all</module>
        <module>bom</module>
        <module>common</module>
        <module>config</module>
        <module>console</module>
        <module>core</module>
        <module>compatible</module>
        <module>dependencies</module>
        <module>discovery</module>
        <module>distribution</module>
        <module>integration/rpc-core</module>
        <module>integration/dubbo</module>
        <module>integration/dubbo-alibaba</module>
        <module>integration/sofa-rpc</module>
        <module>integration/motan</module>
        <module>integration/grpc</module>
        <module>integration/http</module>
        <module>integration/http-jakarta</module>
        <module>integration/hsf</module>
        <module>integration/brpc</module>
        <module>rm</module>
        <module>rm-datasource</module>
        <module>rocketmq</module>
        <module>spring</module>
        <module>tcc</module>
        <module>test</module>
        <module>test-mock-server</module>
        <module>test-old-version</module>
        <module>tm</module>
        <module>metrics</module>
        <module>serializer</module>
        <module>seata-spring-boot-starter</module>
        <module>seata-spring-autoconfigure</module>
        <module>compressor</module>
        <module>saga</module>
        <module>sqlparser</module>
        <module>server</module>
        <module>ext/apm-seata-skywalking-plugin</module>
        <module>integration-tx-api</module>
        <module>namingserver</module>
        <!--<module>seata-plugin</module>-->
    </modules>

    <!--test-->
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-suite-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-suite-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.seata</groupId>
                <artifactId>seata-dependencies</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <!-- profile: licenseCheck -->
        <profile>
            <id>licenseCheck</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>license-check</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-third-party</goal>
                                </goals>
                                <configuration>
                                    <includeOptional>false</includeOptional>
                                    <useMissingFile>false</useMissingFile>
                                    <failOnMissing>false</failOnMissing>
                                    <licenseMerges>
                                        <licenseMerge>Apache License, Version 2.0|The Apache Software License, Version
                                            2.0|ASF 2.0|Apache 2|Apache-2.0|Apache 2.0 License|Apache 2.0|Apache License v2.0|Apache License 2.0|The Apache License, Version 2.0|The Apache Software License, Version 2.0
                                        </licenseMerge>
                                        <licenseMerge>The MIT License|MIT License</licenseMerge>
                                        <licenseMerge>The 3-Clause BSD License|New BSD License|3-Clause BSD
                                            License|BSD|3-Clause BSD License|The New BSD License
                                        </licenseMerge>
                                    </licenseMerges>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- profile: image -->
        <profile>
            <id>image</id>
            <properties>
                <image.publish.skip>false</image.publish.skip>
                <dependencies.copy.skip>false</dependencies.copy.skip>
                <mysql.jdbc.version>5.1.42</mysql.jdbc.version>
                <mysql8.jdbc.version>8.0.27</mysql8.jdbc.version>
                <maven.git-commit-id.skip>false</maven.git-commit-id.skip>
            </properties>
        </profile>
        <!-- profile: release-image-based-on-java8 -->
        <profile>
            <id>release-image-based-on-java8</id>
            <properties>
                <image.tags>${project.version},latest</image.tags>
                <maven.git-commit-id.skip>false</maven.git-commit-id.skip>
            </properties>
        </profile>
        <!-- profile: release-image-based-on-java8-slim -->
        <profile>
            <id>release-image-based-on-java8-slim</id>
            <properties>
                <image.tags>${project.version}-slim</image.tags>
                <maven.git-commit-id.skip>false</maven.git-commit-id.skip>
            </properties>
        </profile>
        <!-- profile: release-image-based-on-java17 -->
        <profile>
            <id>release-image-based-on-java17</id>
            <properties>
                <image.tags>${project.version}.jre17</image.tags>
                <maven.git-commit-id.skip>false</maven.git-commit-id.skip>
            </properties>
        </profile>
        <!-- profile: release-image-based-on-java17-slim -->
        <profile>
            <id>release-image-based-on-java17-slim</id>
            <properties>
                <image.tags>${project.version}.jre17-slim</image.tags>
                <maven.git-commit-id.skip>false</maven.git-commit-id.skip>
            </properties>
        </profile>
        <!-- profile: checkstyle -->
        <profile>
            <id>checkstyle</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>remove</goal>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <quiet>true</quiet>
                            <header>${user.dir}/style/copyright</header>
                            <includes>
                                <include>**/src/main/java/**</include>
                                <include>**/src/test/java/**</include>
                                <include>**/*.xml</include>
                                <include>**/*.sql</include>
                                <include>**/*.conf</include>
                                <include>**/*.yml</include>
                                <include>**/*.yaml</include>
                                <include>**/*.sh</include>
                                <include>**/*.bat</include>
                                <include>**/*.lua</include>
                                <include>**/*.properties</include>
                                <include>**/*.txt</include>
                                <include>**/*.def</include>
                            </includes>
                            <excludes>
                                <exclude>**/script/**</exclude>
                                <exclude>**/generated/**</exclude>
                                <exclude>**/antlr/mysql/parser/*.*</exclude>
                                <exclude>**/antlr/mysql/antlr/*.*</exclude>
                                <exclude>**/antlr/mysql/stream/ANTLRNoCaseStringStream.java</exclude>
                            </excludes>
                            <strictCheck>true</strictCheck>
                            <mapping>
                                <java>SLASHSTAR_STYLE</java>
                                <lua>DOUBLEBAR_STYLE</lua>
                                <conf>SCRIPT_STYLE</conf>
                                <def>SCRIPT_STYLE</def>
                            </mapping>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>validate</id>
                                <phase>validate</phase>
                                <configuration>
                                    <configLocation>${user.dir}/style/seata_checkstyle.xml</configLocation>
                                    <suppressionsLocation>${user.dir}/style/seata_suppressions.xml</suppressionsLocation>
                                    <encoding>UTF-8</encoding>
                                    <consoleOutput>true</consoleOutput>
                                    <failsOnError>true</failsOnError>
                                </configuration>
                                <goals>
                                    <goal>checkstyle</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>
        <plugins>
            <!-- Source -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <configuration>
                    <excludes>
                        <exclude>**/*.java.template</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- PMD-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${maven-pmd-plugin.version}</version>
                <configuration>
                    <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                    <minimumPriority>2</minimumPriority>
                    <printFailingErrors>true</printFailingErrors>
                    <rulesets>
                        <ruleset>rulesets/java/ali-comment.xml</ruleset>
                        <ruleset>rulesets/java/ali-concurrent.xml</ruleset>
                        <ruleset>rulesets/java/ali-constant.xml</ruleset>
                        <ruleset>rulesets/java/ali-exception.xml</ruleset>
                        <ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>
                        <ruleset>rulesets/java/ali-naming.xml</ruleset>
                        <ruleset>rulesets/java/ali-oop.xml</ruleset>
                        <ruleset>rulesets/java/ali-orm.xml</ruleset>
                        <ruleset>rulesets/java/ali-other.xml</ruleset>
                        <ruleset>rulesets/java/ali-set.xml</ruleset>
                    </rulesets>
                    <excludes>
                        <exclude>**/generated/*.java</exclude>
                        <exclude>**/antlr/mysql/parser/*.*</exclude>
                        <exclude>**/antlr/mysql/antlr/*.*</exclude>
                        <exclude>**/antlr/mysql/stream/ANTLRNoCaseStringStream.java</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>pmd-check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.alibaba.p3c</groupId>
                        <artifactId>p3c-pmd</artifactId>
                        <version>${p3c-pmd.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!-- JaCoCo -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- SureFire -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <argLine>${maven.surefire.argLine}</argLine>
                    <excludes>${maven.surefire.excludes}</excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
