<?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>it.bz.opendatahub.alpinebits</groupId>
    <artifactId>alpinebits-root</artifactId>
    <version>2.1.0</version>
    <packaging>pom</packaging>
    <name>AlpineBits</name>
    <description>
        AlpineBits is an open standard to exchange touristic data.

        This library provides functionality to implement AlpineBits server. Use it to build your own standalone AlpineBits server, or integrate parts of it into your existing code base.
    </description>
    <url>https://www.alpinebits.org/</url>

    <scm>
        <url>https://github.com/noi-techpark/odh-alpinebits</url>
    </scm>

    <modules>
        <module>alpinebits-common</module>
        <module>alpinebits-db</module>
        <module>alpinebits-handshaking</module>
        <module>alpinebits-housekeeping</module>
        <module>alpinebits-middleware</module>
        <module>alpinebits-routing</module>
        <module>alpinebits-servlet</module>
        <module>alpinebits-validation</module>
        <module>alpinebits-xml</module>
        <module>build-tools</module>
        <module>examples</module>
    </modules>

    <properties>
        <slf4j.version>1.7.25</slf4j.version>
        <log4j-slf4j-impl.version>2.11.1</log4j-slf4j-impl.version>

        <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
        <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>2.20</maven-failsafe-plugin.version>
        <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
        <checkstyle-maven.version>3.1.1</checkstyle-maven.version>
        <puppycrawl-checkstyle.version>8.29</puppycrawl-checkstyle.version>
        <maven-pmd-plugin.version>3.10.0</maven-pmd-plugin.version>
        <sonar-maven-plugin.version>3.4.0.905</sonar-maven-plugin.version>
        <jacoco.version>0.8.2</jacoco.version>

        <versions-maven-plugin.version>2.7</versions-maven-plugin.version>
        <dependency-check-maven.version>5.0.0</dependency-check-maven.version>
        <gitflow-maven-plugin.version>1.10.0</gitflow-maven-plugin.version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>

        <servlet.version>3.1.0</servlet.version>
        <mapstruct.version>1.2.0.Final</mapstruct.version>
        <jackson-databind.version>2.10.0</jackson-databind.version>

        <testng.version>6.14.3</testng.version>
        <mockito.version>2.22.0</mockito.version>
        <arquillian.version>1.4.0.Final</arquillian.version>
        <tomcat-embedded.version>9.0.38</tomcat-embedded.version>
        <rest-assured.version>3.1.1</rest-assured.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <skipTests>false</skipTests>
        <argLine>-Dfile.encoding=UTF-8</argLine>
    </properties>

    <organization>
        <name>IDM Südtirol - Alto Adige</name>
        <url>https://www.idm-suedtirol.com</url>
    </organization>

    <developers>
        <developer>
            <name>Christian Gapp</name>
            <email>gapp.christian@gmail.com</email>
            <url>https://gappc.net/</url>
            <id>gappc</id>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>MPLv2 License</name>
            <url>https://www.mozilla.org/en-US/MPL/2.0/</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <profiles>
        <profile>
            <!-- Execute this profile to run integration tests -->
            <id>it</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-tomcat-embedded-8</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-core</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-jasper</artifactId>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <!-- Integration tests -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>report</id>
            <properties>
                <!-- Exclude *Exception.java from code coverage reports -->
                <sonar.coverage.exclusions>**/*Exception.java,**/*Entity.java</sonar.coverage.exclusions>
                <!-- Exclude *Entity.java from code duplication reports -->
                <sonar.cpd.exclusions>**/*Entity.java</sonar.cpd.exclusions>
                <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>security-scan</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sources</id>
            <build>
                <plugins>
                    <!-- Generate sources jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Generate javadoc -->
                    <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>
                        <configuration>
                            <sourceFileExcludes>
                                <!--Exclude tests-->
                                <exclude>**/**Test.java</exclude>
                                <exclude>**/**IT.java</exclude>
                            </sourceFileExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <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>
                            <stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
                        </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>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-common-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-common-utils</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-db-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-db-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-handshaking-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-handshaking-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-housekeeping-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-housekeeping-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-middleware-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-middleware-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-routing-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-routing-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-servlet-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-servlet-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-validation-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-validation-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-xml-api</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>alpinebits-xml-impl</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>examples-housekeeping</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>examples-freerooms</artifactId>
                <version>2.1.0</version>
            </dependency>
            <dependency>
                <groupId>it.bz.opendatahub.alpinebits</groupId>
                <artifactId>examples-inventory</artifactId>
                <version>2.1.0</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${servlet.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct-jdk8</artifactId>
                <version>${mapstruct.version}</version>
            </dependency>

            <!-- Test dependencies -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-nop</artifactId>
                <version>${slf4j.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>io.rest-assured</groupId>
                <artifactId>rest-assured</artifactId>
                <version>${rest-assured.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>io.rest-assured</groupId>
                <artifactId>xml-path</artifactId>
                <version>${rest-assured.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- Integration test dependencies -->
            <dependency>
                <groupId>org.jboss.arquillian.testng</groupId>
                <artifactId>arquillian-testng-container</artifactId>
                <version>1.4.0.Final</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-tomcat-embedded-8</artifactId>
                <version>1.1.0.Final</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-core</artifactId>
                <version>${tomcat-embedded.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-jasper</artifactId>
                <version>${tomcat-embedded.version}</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Compile sources -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>org.mapstruct</groupId>
                                <artifactId>mapstruct-processor</artifactId>
                                <version>${mapstruct.version}</version>
                            </path>
                        </annotationProcessorPaths>
                        <compilerArgs>
                            <compilerArg>
                                -Amapstruct.unmappedTargetPolicy=ERROR
                            </compilerArg>
                        </compilerArgs>
                    </configuration>
                </plugin>

                <!-- Control environmental constraints -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-java</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireJavaVersion>
                                        <version>[1.8,)</version>
                                    </requireJavaVersion>
                                    <requireMavenVersion>
                                        <version>[3.2.1,)</version>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- Check code style -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${checkstyle-maven.version}</version>
                    <executions>
                        <execution>
                            <id>verify-style</id>
                            <phase>validate</phase>
                            <configuration>
                                <configLocation>build-tools/src/main/resources/checkstyle.xml</configLocation>
                                <suppressionsLocation>
                                    build-tools/src/main/resources/checkstyle-suppressions.xml
                                </suppressionsLocation>
                                <consoleOutput>true</consoleOutput>
                                <includeTestSourceDirectory>true</includeTestSourceDirectory>
                                <!--check only src directory, ignore generated sources-->
                                <sourceDirectories>
                                    <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                                </sourceDirectories>
                            </configuration>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${puppycrawl-checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <!-- Unit tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <parallel>true</parallel>
                        <skipTests>${skipTests}</skipTests>
                        <!--
                            ISSUE: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked
                                VM terminated without properly saying goodbye
                            TEMP SOLUTION: set "useSystemClassLoader" to false
                            See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925 and
                                https://issues.apache.org/jira/browse/SUREFIRE-1588
                        -->
                        <useSystemClassLoader>false</useSystemClassLoader>
                    </configuration>
                </plugin>

                <!-- Integration tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <!--
                            ISSUE: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked
                                VM terminated without properly saying goodbye
                            TEMP SOLUTION: set "useSystemClassLoader" to false
                            See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925 and
                                https://issues.apache.org/jira/browse/SUREFIRE-1588
                        -->
                        <useSystemClassLoader>false</useSystemClassLoader>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>verify</id>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Static source code analyzer -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${maven-pmd-plugin.version}</version>
                    <configuration>
                        <aggregate>true</aggregate>
                        <failurePriority>3</failurePriority>
                        <printFailingErrors>true</printFailingErrors>
                        <rulesets>
                            <ruleset>build-tools/src/main/resources/pmd.xml</ruleset>
                        </rulesets>
                        <linkXRef>false</linkXRef>
                    </configuration>
                </plugin>

                <!-- Inspection of code quality -->
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${sonar-maven-plugin.version}</version>
                </plugin>

                <!-- Code coverage -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                    <configuration>
                        <append>true</append>
                    </configuration>
                    <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-prepare-agent-integration</id>
                            <goals>
                                <goal>prepare-agent-integration</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-report-integration</id>
                            <goals>
                                <goal>report-integration</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Check deployed version -->
                <plugin>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <version>2.2.4</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
                        <failOnNoGitDirectory>false</failOnNoGitDirectory>
                    </configuration>
                </plugin>

                <!-- Support various Git workflows -->
                <plugin>
                    <groupId>com.amashchenko.maven.plugin</groupId>
                    <artifactId>gitflow-maven-plugin</artifactId>
                    <version>${gitflow-maven-plugin.version}</version>
                </plugin>

                <!-- Manage artifact versions -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${versions-maven-plugin.version}</version>
                </plugin>

                <!-- Check dependencies for vulnerabilities -->
                <plugin>
                    <groupId>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <version>${dependency-check-maven.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <failBuildOnCVSS>8</failBuildOnCVSS>
                        <cveValidForHours>24</cveValidForHours>
                        <skipProvidedScope>true</skipProvidedScope>
                    </configuration>
                </plugin>

                <!-- Generate Javadoc -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                </plugin>

                <!-- Generate sources jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>

            <!--run code quality checks-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
        </plugins>

        <extensions>
            <extension>
                <groupId>org.springframework.build</groupId>
                <artifactId>aws-maven</artifactId>
                <version>5.0.0.RELEASE</version>
            </extension>
        </extensions>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>
</project>
