<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2018 envimate GmbH - https://envimate.com/.
  ~
  ~ 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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <groupId>com.envimate</groupId>
    <artifactId>envimate-opensource-parent</artifactId>
    <version>1.0.25</version>
    <name>Envimate OpenSource java standards</name>
    <description>
        This parent pom is supposed to be used as a parent for all envimate open source projects to reliably enable
        the enforcement of java standards like library blacklisting, code style rules, and more.
    </description>
    <url>https://github.com/envimate/envimate-opensource-parent</url>

    <organization>
        <name>envimate GmbH</name>
        <url>https://www.envimate.com</url>
    </organization>

    <properties>
        <java.version>11</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.source.skip>true</maven.source.skip>
        <maven.javadoc.skip>true</maven.javadoc.skip>
    </properties>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICmaven-compiler-pluginENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Richard Hauswald</name>
            <email>richard.hauswald@envimate.com</email>
            <organization>envimate GmbH</organization>
            <organizationUrl>https://www.envimate.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/envimate/envimate-opensource-parent</url>
        <connection>scm:git:git://github.com/envimate/envimate-opensource-parent.git</connection>
        <developerConnection>scm:git:git@github.com:envimate/envimate-opensource-parent.git</developerConnection>
    </scm>

    <distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>envimate.opensource.sonatype.staging</id>
            <name>Sonatype Staging</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
            <layout>default</layout>
        </repository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                        <failOnError>true</failOnError>
                        <release>${java.version}</release>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <debug>true</debug>
                        <parameters>true</parameters>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                            <arg>-Xlint:-processing</arg>
                            <arg>-Xlint:-serial</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.0</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <phase>package</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.1.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <phase>package</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M2</version>
                    <executions>
                        <execution>
                            <id>enforce-maven</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>3.6</version>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>deployToMavenCentral</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>deployToMavenCentral</name>
                </property>
            </activation>
            <properties>
                    <maven.compiler.failOnWarning>true</maven.compiler.failOnWarning>
                    <maven.source.skip>false</maven.source.skip>
                    <maven.javadoc.skip>false</maven.javadoc.skip>
                    <testMode>RELEASE</testMode>
            </properties>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <version>1.6</version>
                            <configuration>
                                <keyname>0xACB977BA5C6D5C6E</keyname>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>sign-artifacts</id>
                                    <phase>verify</phase>
                                    <goals>
                                        <goal>sign</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.sonatype.plugins</groupId>
                            <artifactId>nexus-staging-maven-plugin</artifactId>
                            <version>1.6.8</version>
                            <extensions>true</extensions>
                            <configuration>
                                <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                                <serverId>envimate.opensource.sonatype.staging</serverId>
                                <autoReleaseAfterClose>true</autoReleaseAfterClose>
                                <autoDropAfterRelease>true</autoDropAfterRelease>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>Tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>skipTests</name>
                    <value>!true</value>
                </property>
            </activation>
            <properties>
                <maven.compiler.failOnWarning>true</maven.compiler.failOnWarning>
                <maven.source.skip>false</maven.source.skip>
                <maven.javadoc.skip>false</maven.javadoc.skip>
                <testMode>NORMAL</testMode>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>
                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>3.0.0-M3</version>
                            <configuration>
                                <trimStackTrace>false</trimStackTrace>
                                <includes>
                                    <include>**/*Specs.java</include>
                                    <include>**/*Test.java</include>
                                </includes>
                                <systemPropertyVariables>
                                    <testMode>${testMode}</testMode>
                                </systemPropertyVariables>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <profile>
            <id>StaticCodeAnalysisTests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>skipTests</name>
                    <value>!true</value>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs-maven-plugin</artifactId>
                            <version>3.1.12.2</version>
                            <configuration>
                                <includeTests>true</includeTests>
                                <trace>true</trace>
                                <effort>Max</effort>
                                <threshold>low</threshold>
                            </configuration>
                            <executions>
                                <execution>
                                    <phase>test</phase>
                                    <goals>
                                        <goal>check</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <dependencies>
                                <dependency>
                                    <groupId>com.github.spotbugs</groupId>
                                    <artifactId>spotbugs</artifactId>
                                    <version>4.0.0-beta4</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-checkstyle-plugin</artifactId>
                            <version>3.1.0</version>
                            <dependencies>
                                <dependency>
                                    <groupId>com.puppycrawl.tools</groupId>
                                    <artifactId>checkstyle</artifactId>
                                    <version>8.26</version>
                                </dependency>
                            </dependencies>
                            <executions>
                                <execution>
                                    <id>checkCodeStyle</id>
                                    <goals>
                                        <goal>check</goal>
                                    </goals>
                                    <phase>process-test-classes</phase>
                                    <configuration>
                                        <configLocation>
                                            https://raw.githubusercontent.com/envimate/envimate-opensource-parent/master/checkstyle/checkstyle.xml
                                        </configLocation>
                                        <encoding>UTF-8</encoding>
                                        <consoleOutput>true</consoleOutput>
                                        <failOnViolation>true</failOnViolation>
                                        <violationSeverity>info</violationSeverity>
                                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                                        <includes>**\/*.java,**\/*.xml,**\/*.properties</includes>
                                        <testSourceDirectories>
                                            <testSourceDirectory>${project.build.testSourceDirectory}
                                            </testSourceDirectory>
                                            <testSourceDirectory>${project.basedir}/src/test/pmd</testSourceDirectory>
                                            <testSourceDirectory>${project.basedir}/src/test/checkstyle
                                            </testSourceDirectory>
                                        </testSourceDirectories>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
