<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~  Copyright 1999-2019 Seata.io Group.
  ~
  ~  Licensed 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>io.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>dependencies</module>
        <module>discovery</module>
        <module>distribution</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>spring</module>
        <module>tcc</module>
        <module>test</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>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.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.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>io.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>
                <image.tags>latest</image.tags>
                <dependencies.copy.skip>false</dependencies.copy.skip>
                <mysql.jdbc.version>5.1.35</mysql.jdbc.version>
                <mysql8.jdbc.version>8.0.27</mysql8.jdbc.version>
            </properties>
        </profile>
        <!-- profile: release-image -->
        <profile>
            <id>release-image</id>
            <properties>
                <image.tags>${project.version},latest</image.tags>
            </properties>
        </profile>
        <!-- profile: arrch64 -->
        <profile>
            <id>arrch64</id>
            <properties>
                <os.detected.classifier>osx-x86_64</os.detected.classifier>
            </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>
                            </includes>
                            <excludes>
                                <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>
                            </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>
                <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>
                        <phase>verify</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>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
