<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <prerequisites>
        <maven>${maven-minimum-version}</maven>
    </prerequisites>

    <groupId>com.izettle</groupId>
    <artifactId>izettle-oss</artifactId>
    <version>3.4.3</version>
    <packaging>pom</packaging>
    <name>izettle-oss</name>
    <description>iZettle Base POM for Open Source Software</description>
    <url>https://github.com/iZettle/izettle-maven</url>
    <organization>
        <name>iZettle AB</name>
        <url>https://www.izettle.com</url>
    </organization>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/iZettle/izettle-maven.git</connection>
        <developerConnection>scm:git:git:@github.com:iZettle/izettle-maven.git</developerConnection>
        <url>https://github.com/iZettle/izettle-maven</url>
        <tag>izettle-oss-3.4.3</tag>
    </scm>

    <developers>
        <developer>
            <name>Tim Lord</name>
            <email>tim@izettle.com</email>
            <timezone>Europe/Stockholm</timezone>
            <roles>
                <role>committer</role>
            </roles>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <buildNumber>${project.version}</buildNumber>
        <asm.version>6.2.1</asm.version>
        <checkstyle.version>8.41.1</checkstyle.version>
        <dependency-check-maven.version>6.1.5</dependency-check-maven.version>
        <spotbugs.version>4.2.3</spotbugs.version>
        <spotbugs-maven-plugin.version>4.2.3</spotbugs-maven-plugin.version>
        <findsecbugs-plugin.version>1.11.0</findsecbugs-plugin.version>
        <izettle-checkstyle.version>3.0.0</izettle-checkstyle.version>
        <java.version>1.8</java.version>
        <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
        <maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version>
        <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
        <maven-ejb-plugin.version>3.1.0</maven-ejb-plugin.version>
        <maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
        <maven-failsafe-plugin.version>3.0.0-M4</maven-failsafe-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-install-plugin.version>3.0.0-M1</maven-install-plugin.version>
        <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
        <maven-minimum-version>3.3.9</maven-minimum-version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
        <maven-site-plugin.version>3.9.1</maven-site-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
        <maven-war-plugin.version>3.3.1</maven-war-plugin.version>
        <versions-maven-plugin.version>2.8.1</versions-maven-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    </properties>

    <distributionManagement>
        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Nexus Release Repository</name>
            <url>http://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <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>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>sonatype-nexus-staging</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <stagingProfileId>3fd6902b69bde2</stagingProfileId>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>java8-disable-strict-javadoc</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <javadoc.doclint.none>-Xdoclint:none</javadoc.doclint.none>
            </properties>
        </profile>
        <profile>
            <id>dep-vuln-check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>${dependency-check-maven.version}</version>
                        <configuration>
                            <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <!-- CVSS 4 confirmed with Security Team as
                                         PCI compliance requires -->
                                    <failBuildOnCVSS>4</failBuildOnCVSS>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dep-vuln-check-with-suppression-file</id>
            <activation>
                <file>
                    <exists>cve-dependency-check/ignore.xml</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>${dependency-check-maven.version}</version>
                        <configuration>
                            <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                            <suppressionFiles>
                                <suppressionFile>
                                    cve-dependency-check/ignore.xml
                                </suppressionFile>
                            </suppressionFiles>
                            <!-- CVSS 4 confirmed with Security Team as PCI compliance requires -->
                            <failBuildOnCVSS>4</failBuildOnCVSS>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>static-analysis</id>
            <build>
                <plugins>
                    <!-- SpotBugs Static Analysis -->
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <version>${spotbugs-maven-plugin.version}</version>
                        <dependencies>
                            <dependency>
                                <groupId>com.github.spotbugs</groupId>
                                <artifactId>spotbugs</artifactId>
                                <version>${spotbugs.version}</version>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <effort>Max</effort>
                            <threshold>Exp</threshold>
                            <xmlOutput>true</xmlOutput>
                            <failOnError>true</failOnError>
                            <excludeFilterFile>${session.executionRootDirectory}/findbugs/excludes.xml
                            </excludeFilterFile>
                            <plugins>
                                <!-- Add the security plugin from http://find-sec-bugs.github.io/ -->
                                <plugin>
                                    <groupId>com.h3xstream.findsecbugs</groupId>
                                    <artifactId>findsecbugs-plugin</artifactId>
                                    <version>${findsecbugs-plugin.version}</version>
                                </plugin>
                            </plugins>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-minimum-java-mvn-versions</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>${maven-minimum-version}</version>
                                    </requireMavenVersion>
                                    <requireJavaVersion>
                                        <version>${java.version}</version>
                                    </requireJavaVersion>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <encoding>UTF-8</encoding>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven-war-plugin.version}</version>
                    <inherited>true</inherited>
                    <configuration>
                        <!-- this is servlet 3.0 no need for a web.xml -->
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Implementation-Version>${buildNumber}</Implementation-Version>
                                <Implementation-Title>Build Date: ${maven.build.timestamp}, Build: ${buildNumber}
                                </Implementation-Title>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-ejb-plugin</artifactId>
                    <version>${maven-ejb-plugin.version}</version>
                    <configuration>
                        <ejbVersion>3.1</ejbVersion>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven-shade-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                    <inherited>true</inherited>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Implementation-Version>${buildNumber}</Implementation-Version>
                                <Implementation-Title>Build Date: ${maven.build.timestamp}, Build: ${buildNumber}
                                </Implementation-Title>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <doclint>none</doclint>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <includes>
                            <include>**/*Spec.java</include>
                            <include>**/Test*.java</include>
                            <include>**/*Test.java</include>
                        </includes>
                        <excludes>
                            <exclude>**/*IntegrationTest.java</exclude>
                        </excludes>
                        <parallel>classes</parallel>
                        <threadCount>10</threadCount>
                    </configuration>
                </plugin>
                <!-- Integration tests -->
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <configuration>
                        <argLine>-Xms800m -Xmx800m -XX:MaxMetaspaceSize=512m</argLine>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <tagNameFormat>@{project.artifactId}-@{project.version}</tagNameFormat>
                        <localCheckout>true</localCheckout>
                        <pushChanges>true</pushChanges>
                        <scmCommentPrefix>${project.artifactId}: </scmCommentPrefix>
                        <useReleaseProfile>true</useReleaseProfile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${versions-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${maven-checkstyle-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.izettle</groupId>
                            <artifactId>izettle-checkstyle</artifactId>
                            <version>${izettle-checkstyle.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <includeTestSourceDirectory>false</includeTestSourceDirectory>
                        <failsOnError>true</failsOnError>
                        <consoleOutput>true</consoleOutput>
                        <configLocation>checkstyle/checkstyle.xml</configLocation>
                        <headerLocation>checkstyle/LICENSE.txt</headerLocation>
                        <linkXRef>false</linkXRef>
                    </configuration>
                    <executions>
                        <execution>
                            <id>validate</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
