<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>com.backbase.oss</groupId>
    <artifactId>blade</artifactId>
    <version>4.20.0</version>

    <packaging>pom</packaging>

    <name>Blade :: Parent</name>

    <description>
        The Backbase Local Application Development Environment (Blade) is a convenience plugin to
        run WAR files in an embedded Tomcat container.

        It's specifically tailored to run multiple web applications in a single Tomcat where the startup order is important.

        All dependencies of type WAR are automatically deployed inside Tomcat. The artifactId of each dependency is used as context path.
    </description>

    <url>https://github.com/Backbase/blade</url>

    <developers>
        <developer>
            <id>bartv</id>
            <name>Bart Veenstra</name>
            <organization>Backbase</organization>
            <organizationUrl>https://www.backbase.com</organizationUrl>
            <email>bartv@backbase.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Backbase License 2.0</name>
            <url>https://raw.githubusercontent.com/Backbase/blade/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:Backbase/blade.git</connection>
        <developerConnection>scm:git:ssh://github.com:Backbase/blade.git</developerConnection>
        <url>https://github.com/Backbase/blade/tree/master</url>
    </scm>

    <properties>
        <java.version>1.8</java.version>
        <javac.version>1.8</javac.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <jacoco.version>0.8.4</jacoco.version>

        <tomcat.version>9.0.33</tomcat.version>
        <mavenVersion>3.5.4</mavenVersion>
        <mavenArchiverVersion>3.1.1</mavenArchiverVersion>
        <junit-jupiter.version>5.5.2</junit-jupiter.version>
        <mockito.version>3.2.4</mockito.version>

        <jackson-databind.version>2.10.3</jackson-databind.version>
        <aggregate.report.dir>tests/target/site/jacoco-aggregate/jacoco.xml</aggregate.report.dir>
        <sonar.coverage.jacoco.xmlReportPaths>${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
        <sonar.coverage.jacoco.itReportPath>${project.basedir}/target/jacoco-it.exec</sonar.coverage.jacoco.itReportPath>
        <slf4j-api.version>1.7.30</slf4j-api.version>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

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

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

    <modules>
        <module>blade-common</module>
        <module>blade-ui</module>
        <module>blade-webapp</module>
        <module>blade-maven-plugin</module>
        <!-- Sonar Coverage -->
        <module>tests</module>
    </modules>


    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.7.0.1746</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.5</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.7</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9.4</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <checkModificationExcludes>
                        <checkModificationExclude>blade-ui/src/main/web/package-lock.json</checkModificationExclude>
                    </checkModificationExcludes>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.5</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>site</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>${project.basedir}</sourceDirectory>
                    <sourceDocumentName>readme.adoc</sourceDocumentName>
                    <outputDirectory>${project.build.directory}/docs/</outputDirectory>
                    <backend>html</backend>
                    <doctype>book</doctype>
                    <resources>
                        <resource>
                            <directory>${project.basedir}</directory>
                            <targetPath>${project.build.directory}/docs/</targetPath>
                            <excludes>
                                <exclude>src</exclude>
                                <exclude>target</exclude>
                                <exclude>blade-*</exclude>
                            </excludes>
                            <includes>
                                <include>images/</include>
                                <include>*.png</include>
                                <include>**/*.html</include>
                                <include>**/*.png</include>
                                <include>**/*.readme</include>
                                <include>**/*.gif</include>
                            </includes>
                        </resource>
                    </resources>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- Deployment profile (required so these plugins are only used when deploying) -->
        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                    <!-- Source plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Javadoc 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>
                            </execution>
                        </executions>
                        <configuration>
                            <source>8</source>
                        </configuration>
                    </plugin>

                    <!-- GPG 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>
                                <configuration>
                                    <!-- Prevent `gpg` from using pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>coverage</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <argLine>${failsafe.argLine}</argLine>
                        </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>

                    <!-- Surefire plugin - for running unit tests-->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <skipTests>${skip.unit.tests}</skipTests>
                            <!-- Excludes integration tests when unit tests are run. -->
                            <excludes>
                                <exclude>**/*IT.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>pre-integration-test</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <destFile>${sonar.coverage.jacoco.itReportPath}</destFile>
                                    <propertyName>failsafe.argLine</propertyName>
                                </configuration>
                            </execution>
                            <execution>
                                <id>post-integration-test</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${sonar.coverage.jacoco.itReportPath}</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- sonar -->
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>3.7.0.1746</version>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>


</project>
