<?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">
    <parent>
        <artifactId>open-banking-gateway</artifactId>
        <groupId>de.adorsys.opba</groupId>
        <version>0.30.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>last-module-codecoverage</artifactId>
    <name>last-module-codecoverage</name>
    <packaging>pom</packaging>

    <properties>
        <!-- Hard reference to root directory. Used to reference pmd and checkstyle files from root.
        Change this if depth changes. Current: /open-banking-gateway/last-module-codecoverage -->
        <main.basedir>${project.parent.basedir}</main.basedir>
    </properties>

    <dependencies>
        <!-- ROOT DIR -->
        <!-- Excluding fintech-examples as they are not production code -->
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-rest-api-shared</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-banking-protocol-facade</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-banking-rest-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-banking-rest-impl</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-consent-rest-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-consent-rest-impl</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-db</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-embedded-starter</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-embedded-starter-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>opba-facade-protocol-api-shared</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Excluding sandbox-test as it is testing framework setup -->

        <!-- OPBA-PROTOCOLS DIR -->
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>protocol-bpmn-shared</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>xs2a-protocol</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>hbci-protocol</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>xs2a-sandbox-protocol</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Excluding sandboxes/xs2a-sandbox as it is testing framework setup -->
        <!-- Excluding sandboxes/hbci-sandbox as it is testing sandbox for HBCI -->
        <!-- XS2A-PROTOCOL-TESTS DIR -->
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>xs2a-bdd-sandbox</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Skipping xs2a-bdd-tests-common as it is test-common -->
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>xs2a-bdd-wiremock</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>xs2a-stress-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- END XS2A-PROTOCOL-TESTS DIR -->
        <!-- HBCI-PROTOCOL-TESTS DIR -->
        <dependency>
            <groupId>de.adorsys.opba</groupId>
            <artifactId>hbci-bdd-sandbox</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- END HBCI-PROTOCOL-TESTS DIR -->
        <!-- END OPBA-PROTOCOLS DIR -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>**/generated/**</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <id>copy-resources</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/site/jacoco-aggregate</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/dtd/jacoco</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <version>${xml-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <transformationSets>
                        <transformationSet>
                            <dir>target/site/jacoco-aggregate</dir>
                            <includes>
                                <include>jacoco.xml</include>
                            </includes>
                            <stylesheet>src/main/xsl/analyse.jacoco.result.xsl</stylesheet>
                            <parameters>
                                <parameter>
                                    <name>lowerlimit</name>
                                    <value>20</value>
                                </parameter>
                                <parameter>
                                    <name>outputdir</name>
                                    <value>${project.basedir}/target</value>
                                </parameter>
                            </parameters>
                            <outputDir>target</outputDir>
                        </transformationSet>
                    </transformationSets>
                    <skip>${skipTests}</skip>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.saxon</groupId>
                        <artifactId>saxon</artifactId>
                        <version>${saxon.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

        </plugins>
    </build>
</project>
