<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>3</version>
    </parent>

    <groupId>com.github.yujiaao</groupId>
    <artifactId>c-tools-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.11.3</version>

    <modules>
        <module>c-tools-bom</module>
        <module>common-utils</module>
        <module>c-dbtools</module>
        <module>c-tools</module>
        <module>c-jmesa</module>
        <module>c-cache</module>
        <module>c-r2dbc</module>
        <module>c-tablegen</module>
        <module>c-tablegen-mojo</module>
        <module>c-tablegen-jdbc-demo</module>
        <module>c-tablegen-r2dbc-demo</module>
        <module>c-jsongen</module>
        <module>c-jsongen-es-demo</module>
        <module>c-estools</module>

    </modules>
    <properties>
        <jackson-databind.version>2.10.4</jackson-databind.version>
        <web-access-limit>1.1.9</web-access-limit>
        <justauth-spring.version>1.1.0</justauth-spring.version>
        <junitVersion>5.9.0</junitVersion>
        <springboot.version>2.5.13</springboot.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mysql.version>8.0.30</mysql.version>
        <slf4j.version>1.7.36</slf4j.version>
        <validator.version>6.2.0.Final</validator.version>
        <!--
        For a while, we will provide equivalent Hibernate Validator versions for both EE 8 and EE 9:
        Hibernate Validator 6.x will keep the javax. packages while Hibernate Validator 7.x
        moved to the jakarta. packages.

        https://in.relation.to/2021/01/06/hibernate-validator-700-62-final-released/
         -->
    </properties>

    <dependencies>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>

    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <argLine>@{argLine} -server -ea -Xmx4g </argLine>
                    <skip>false</skip>
                    <testFailureIgnore>false</testFailureIgnore>
                    <excludes>
                        <exclude>**/controller/*ControllerTest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>



            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.8</version>
                <executions>
                    <execution>
                        <id>pre-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>

                    </execution>

                </executions>
                <configuration>
                    <dataFile>target/jacoco.exec</dataFile>
                    <!-- Sets the output directory for the code coverage report. -->
                    <outputDirectory>target/jacoco-ut</outputDirectory>
                    <rules>
                        <rule implementation="org.jacoco.maven.RuleConfiguration">
                            <element>PACKAGE</element>
                            <limits>
                                <limit implementation="org.jacoco.report.check.Limit">
                                    <counter>COMPLEXITY</counter>
                                    <value>COVEREDRATIO</value>
                                    <minimum>0.00</minimum>
                                </limit>
                            </limits>
                        </rule>
                    </rules>
                    <excludes>
                        <exclude>com/some/dao/model/**/*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.9.1</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>

        </plugins>

    </build>


    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.13.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>


        </plugins>

    </reporting>


    <profiles>
        <profile>
            <id>pro</id>
            <properties>
                <profiles.active>pro</profiles.active>
                <modifier>-pro</modifier>
            </properties>
            <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>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration> <!-- add this to disable checking -->
                            <additionalOptions>-Xdoclint:none</additionalOptions>
                            <useStandardDocletOptions>false</useStandardDocletOptions>
                            <failOnError>false</failOnError>
                            <sourceFileExcludes>
                                <sourceFileExclude>**/module-info.java</sourceFileExclude>
                            </sourceFileExcludes>
                            <source>11</source>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- This is necessary for gpg to not try to use the pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.thoughtworks.xstream</groupId>
                                <artifactId>xstream</artifactId>
                                <version>1.4.15</version> <!-- apparently this needs to be exactly this version -->
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>

        </profile>
    </profiles>


    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>${repo.release}</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>${repo.snapshot}</url>
        </snapshotRepository>
    </distributionManagement>


</project>
