<?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>com.10duke.client.parent</groupId>
    <artifactId>java</artifactId>
    <version>1.1.0</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>com.10duke.client.parent</groupId>
        <artifactId>maven</artifactId>
        <version>1.1.0</version>
        <relativePath>../maven/pom.xml</relativePath>
    </parent>

    <name>com.10duke.client.parent:java</name>
    <description>Parent-POM for java-artifacts</description>

    <properties>
        <xd.module.groupId>com.tenduke.client</xd.module.groupId>
        <xd.module.name>${xd.module.groupId}.${project.artifactId}</xd.module.name>

        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <xd.maven.version>3.5.0</xd.maven.version>

        <xd.jackson-databind.version>2.9.9.3</xd.jackson-databind.version>
        <xd.jsr305.version>3.0.2</xd.jsr305.version>
        <xd.logback.version>1.2.3</xd.logback.version>
        <xd.openjfx.version>11.0.2</xd.openjfx.version>
        <xd.slf4j.version>1.7.27</xd.slf4j.version>
        
        <xd.assertj.version>3.13.2</xd.assertj.version>
        <xd.junit.version>4.13.2</xd.junit.version>
        <xd.mockito.version>2.27.0</xd.mockito.version>
        
        <xd.checkstyle.version>8.23</xd.checkstyle.version>
        <xd.jacoco-maven-plugin.version>0.8.4</xd.jacoco-maven-plugin.version>
        <xd.license-maven-plugin.version>1.20</xd.license-maven-plugin.version>
        <xd.maven-checkstyle-plugin.version>3.1.0</xd.maven-checkstyle-plugin.version>
        <xd.maven-dependency-plugin.version>3.1.1</xd.maven-dependency-plugin.version>
        <xd.maven-compiler-plugin.version>3.8.1</xd.maven-compiler-plugin.version>
        <xd.maven-enforcer-plugin.version>3.0.0-M2</xd.maven-enforcer-plugin.version>
        <xd.maven-jar-plugin.version>3.1.2</xd.maven-jar-plugin.version>
        <xd.maven-pmd-plugin.version>3.12.0</xd.maven-pmd-plugin.version>
        <xd.maven-source-plugin.version>3.1.0</xd.maven-source-plugin.version>
        <xd.maven-surefire-plugin.version>3.0.0-M3</xd.maven-surefire-plugin.version>
        <xd.spotbugs-maven-plugin.version>3.1.12.2</xd.spotbugs-maven-plugin.version>
        <xd.spotbugs.version>3.1.12</xd.spotbugs.version>
        <xd.versions-maven-plugin.version>2.7</xd.versions-maven-plugin.version>
        
        <jacocoArgLine />
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${xd.logback.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-annotations</artifactId>
                <version>${xd.spotbugs.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>${xd.jsr305.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${xd.junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${xd.assertj.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${xd.mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${xd.slf4j.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${xd.spotbugs-maven-plugin.version}</version>
                    <dependencies>
                        <!-- Version of SpotBugs used by the maven plugin -->
                        <dependency>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs</artifactId>
                            <version>${xd.spotbugs.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${xd.maven-checkstyle-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${xd.checkstyle.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.10duke.client</groupId>
                            <artifactId>build-tools</artifactId>
                            <version>1.1.0</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>com/tenduke/client/checkstyle/checkstyle.xml</configLocation>
                        <failsOnError>true</failsOnError>
                        <violationSeverity>warning</violationSeverity>
                        <consoleOutput>true</consoleOutput>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${xd.maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                        <forceJavacCompilerUse>true</forceJavacCompilerUse>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default-compile</id>
                            <configuration>
                                <compilerArgs>
                                    <arg>-Xlint:all</arg>
                                    <arg>-Werror</arg>
                                </compilerArgs>
                            </configuration>
                        </execution>
                        <execution>
                            <id>default-testCompile</id>
                            <configuration>
                                <compilerArgs>
                                </compilerArgs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${xd.maven-dependency-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${xd.maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-ban-duplicate-classes</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <banDuplicateClasses>
                                        <scopes>
                                            <scope>compile</scope>
                                            <scope>provided</scope>
                                        </scopes>
                                        <findAllDuplicates>true</findAllDuplicates>
                                        <ignoreWhenIdentical>true</ignoreWhenIdentical>
                                    </banDuplicateClasses>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                        <execution>
                            <id>enforce-banned-dependencies</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <bannedDependencies>
                                        <excludes>
                                            <exclude>com.10duke.client:test-utils</exclude>
                                        </excludes>
                                        <includes>
                                            <include>com.10duke.client:test-utils:*:*:test</include>
                                        </includes>
                                    </bannedDependencies>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                        <execution>
                            <id>enforce-dependency-convergence</id>
                            <configuration>
                                <rules>
                                    <dependencyConvergence/>
                                </rules>
                            </configuration>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>enforce-java-version</id>
                            <configuration>
                                <rules>
                                    <requireJavaVersion>
                                        <version>${maven.compiler.target}</version>
                                    </requireJavaVersion>
                                </rules>
                            </configuration>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>enforce-maven-version</id>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>${xd.maven.version}</version>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>require-upper-bound-deps</id>
                            <configuration>
                                <rules>
                                    <requireUpperBoundDeps/>
                                </rules>
                            </configuration>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>extra-enforcer-rules</artifactId>
                            <version>1.2</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${xd.maven-jar-plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultEntries>true</addDefaultEntries>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Automatic-Module-Name>${xd.module.name}</Automatic-Module-Name>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${xd.maven-pmd-plugin.version}</version>
                    <configuration>
                        <linkXref>true</linkXref>
                        <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                        <minimumTokens>100</minimumTokens>
                        <rulesets>
                            <ruleset>com/tenduke/client/pmd/pmd-ruleset.xml</ruleset>
                        </rulesets>
                        <failurePriority>4</failurePriority>
                        <skip>true</skip>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.10duke.client</groupId>
                            <artifactId>build-tools</artifactId>
                            <version>1.1.0</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                                <goal>cpd-check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${xd.maven-source-plugin.version}</version>
                </plugin>                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${xd.maven-surefire-plugin.version}</version>
                    <configuration>
                        <forkCount>1</forkCount>
                        <reuseForks>false</reuseForks>
                        <trimStackTrace>false</trimStackTrace>
                        <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true @{jacocoArgLine}</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${xd.license-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${xd.versions-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${xd.jacoco-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>default-prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-check</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <rule>
                                        <element>BUNDLE</element>
                                        <limits>
                                            <limit>
                                                <counter>BRANCH</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                            <limit>
                                                <counter>LINE</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                            <limit>
                                                <counter>CLASS</counter>
                                                <value>MISSEDCOUNT</value>
                                                <maximum>7</maximum>
                                            </limit>
                                            <limit>
                                                <counter>METHOD</counter>
                                                <value>MISSEDCOUNT</value>
                                                <maximum>57</maximum>
                                            </limit>
                                        </limits>
                                    </rule>
                                    <rule>
                                        <element>PACKAGE</element>
                                        <limits>
                                            <limit>
                                                <counter>BRANCH</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                            <limit>
                                                <counter>LINE</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                    <rule>
                                        <element>CLASS</element>
                                        <limits>
                                            <limit>
                                                <counter>BRANCH</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                            <limit>
                                                <counter>LINE</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <propertyName>jacocoArgLine</propertyName>
                    </configuration>
                </plugin>

            </plugins>
            
        </pluginManagement>
    </build>
    
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>no-qa</id>
            <activation>
                <property>
                    <name>no-qa</name>
                </property>
            </activation>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-test</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
           
    </profiles>

</project>
