<?xml version="1.0" encoding="UTF-8"?><!--
  ~ Copyright 2018-2019 adorsys GmbH & Co KG
  ~
  ~ Licensed 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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>de.adorsys.opba</groupId>
    <artifactId>open-banking-gateway</artifactId>
    <version>0.0.5</version>
    <packaging>pom</packaging>

    <name>open-banking-gateway</name>
    <description>Provides Access to Banking API</description>

    <modules>
        <module>opba-consent-rest-api</module>
        <module>core</module>
        <module>sandbox-test</module>
        <module>opba-banking-rest-api</module>
        <module>opba-embedded-starter</module>
        <module>fintech-examples</module>
        <module>last-module-codecoverage</module>
    </modules>

    <url>https://github.com/adorsys/open-banking-gateway</url>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Francis Pouatcha</name>
            <email>fpo@adorsys.de</email>
            <organization>adorsys GmbH &amp; Co KG</organization>
            <organizationUrl>https://adorsys.de/</organizationUrl>
        </developer>
        <developer>
            <name>Denys Golubiev</name>
            <email>dgo@adorsys.de</email>
            <organization>adorsys GmbH &amp; Co KG</organization>
            <organizationUrl>https://adorsys.de/</organizationUrl>
        </developer>
    </developers>

    <properties>
        <!-- Hard reference to main lib. -->
        <main.basedir>${project.basedir}</main.basedir>
        <!-- Common properties -->
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <dependency.locations.enabled>false</dependency.locations.enabled>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
        <java.version>1.8</java.version>
        <pmd.plugin.version>3.10.0</pmd.plugin.version>
        <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>

        <!-- Framework libs -->
        <spring-boot.version>2.2.2.RELEASE</spring-boot.version>
        <guava.version>28.1-jre</guava.version>
        <apache.commons-lang3.version>3.9</apache.commons-lang3.version>
        <fasterxml.version>2.10.1</fasterxml.version>
        <fasterxml-data-format.version>2.9.8</fasterxml-data-format.version>
        <swaggerv3.version>2.1.0</swaggerv3.version>
        <swagger.version>1.5.23</swagger.version>
        <swagger-codegen-generators.version>1.0.11</swagger-codegen-generators.version>
        <swagger-codegen-maven-plugin.version>3.0.11</swagger-codegen-maven-plugin.version>
        <springdoc-openapi-ui.version>1.2.21</springdoc-openapi-ui.version> <!-- springfox replacement for OpenApi 3 -->
        <springfox.version>2.9.2</springfox.version>
        <jetbrains.annotations.version>17.0.0</jetbrains.annotations.version>
        <lombok.version>1.18.10</lombok.version>
        <xml-maven-plugin.version>1.0.2</xml-maven-plugin.version>
        <checkstyle-plugin.version>3.1.0</checkstyle-plugin.version>
        <spotbugs-plugin.version>3.1.12.2</spotbugs-plugin.version>
        <maven.jxr.plugin.version>3.0.0</maven.jxr.plugin.version>
        <bouncycastle.version>1.64</bouncycastle.version>
        <liquibase.version>3.8.0</liquibase.version>
        <mapstruct.version>1.3.1.Final</mapstruct.version>

        <!-- Flowable BPMN -->
        <flowable.version>6.4.2</flowable.version>

        <!-- Adorsys libs -->
        <xs2a.version>5.1</xs2a.version>
        <xs2a-adapter.version>0.0.5</xs2a-adapter.version>

        <!-- Test libs -->
        <jacoco.version>0.8.4</jacoco.version>
        <jupiter.version>5.5.2</jupiter.version>
        <junit.platform.commons.version>1.5.2</junit.platform.commons.version>
        <surefire.version>3.0.0-M3</surefire.version>
        <assertj.version>3.12.2</assertj.version>
        <jgiven.version>1.0.0-RC3</jgiven.version>
        <wiremock.version>2.25.1</wiremock.version>
        <testcontainers.version>1.12.4</testcontainers.version>
        <slf4j-simple.version>1.7.29</slf4j-simple.version>
        <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
        <!-- other properties -->
        <lombok-maven-plugin.version>1.18.6.0</lombok-maven-plugin.version>
        <maven.dependency.plugin.version>3.1.1</maven.dependency.plugin.version>
        <maven-remote-resources-plugin.version>1.6.0</maven-remote-resources-plugin.version>
        <maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
        <surefireArgLine/>

    </properties>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>snapshots-repo</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${apache.commons-lang3.version}</version>
            </dependency>
            <!-- swagger -->
            <dependency>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swaggerv3.version}</version>
            </dependency>

            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swagger.version}</version>
            </dependency>

            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${springfox.version}</version>
            </dependency>

            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${springfox.version}</version>
            </dependency>

            <!-- Spring Boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Lombok -->
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>

            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>${jetbrains.annotations.version}</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${fasterxml.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${fasterxml.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jsr310</artifactId>
                <version>${fasterxml.version}</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-yaml</artifactId>
                <version>${fasterxml-data-format.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-core</artifactId>
                <version>${liquibase.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>ch.qos.logback</groupId>
                        <artifactId>logback-classic</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-simple.version}</version>
            </dependency>

            <!-- Test -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${jupiter.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <!-- lombok and mapstruct -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>

            <!-- pmd -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${pmd.plugin.version}</version>
                <configuration>
                    <includeTests>true</includeTests>
                    <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                    <minimumTokens>100</minimumTokens>
                    <targetJdk>${java.version}</targetJdk>
                    <analysisCache>true</analysisCache>
                    <linkXRef>false</linkXRef>
                    <rulesets>
                        <ruleset>${main.basedir}/backend.pmd-ruleset.xml</ruleset>
                    </rulesets>
                    <excludeRoots>
                        <excludeRoot>${project.build.directory}/generated-sources</excludeRoot>
                    </excludeRoots>
                    <failOnViolation>true</failOnViolation>
                    <printFailingErrors>true</printFailingErrors>
                </configuration>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>pmd</goal>
                            <goal>cpd</goal>
                            <goal>cpd-check</goal>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- checkstyle -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle-plugin.version}</version>
                <configuration>
                    <configLocation>${main.basedir}/backend.checkstyle.xml</configLocation>
                    <encoding>UTF-8</encoding>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <linkXRef>false</linkXRef>
                    <sourceDirectories>
                        <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                    </sourceDirectories>
                    <excludes>**/generated/**/*</excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- code coverage -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report-aggregate</id>
                        <phase>package</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <append>true</append>
                    <propertyName>surefireArgLine</propertyName>
                </configuration>
            </plugin>

            <!-- junit tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.version}</version>
                <configuration>
                    <argLine>${surefireArgLine}</argLine>
                </configuration>
            </plugin>

            <!-- integration tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <classpathDependencyScopeExclude>provided</classpathDependencyScopeExclude>
                </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>

        <!-- as cobertura still does not support lamda expressions, we get a lot of warnings of type:
        Last useful checkpoint: "de.adorsys.opba.core.protocol.config.flowable.FlowableConfig.storeCustomClassesAsJson(String,int,ObjectMapper)"
        Encountered " ">" "> "" at line 28, column 37.
        As it is not supported for 5 years, does not make sense to use it at all
        https://github.com/MoodCat/MoodCat.me-Core/issues/103
        -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>${cobertura-maven-plugin.version}</version>
                <configuration>
                    <quiet>true</quiet>
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
                    <check />
                    <encoding>UTF-8</encoding>
                    <instrumentation>
                        <includes>
                            <include>target/generated-sources/**/src/main/java</include>
                        </includes>
                    </instrumentation>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>${maven.jxr.plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <scm>
        <connection>scm:git@github.com:adorsys/open-banking-gateway.git</connection>
        <developerConnection>scm:git:git@github.com:adorsys/open-banking-gateway.git</developerConnection>
        <url>git@github.com:adorsys/open-banking-gateway.git</url>
        <tag>HEAD</tag>
    </scm>

    <profiles>
        <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>sonatype</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <configuration></configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--
        This profile exist to show Lombok-generated code in javadoc without touching dev and release classes.
        You can generate JavaDoc with comments from lombok using:
        mvn clean javadoc:aggregate -P javadoc
        -->
        <profile>
            <id>javadoc</id>
            <properties>
                <src.dir>target/generated-sources/delombok</src.dir>
                <test.srt.dir>target/generated-test-sources/delombok</test.srt.dir>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok-maven-plugin</artifactId>
                        <version>${lombok-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>delombok</goal>
                                </goals>
                                <configuration>
                                    <addOutputDirectory>false</addOutputDirectory>
                                    <sourceDirectory>src/main/java</sourceDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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

</project>
