<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2016, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>
    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>28</version>
    </parent>
    <groupId>org.jboss.integration</groupId>
    <artifactId>narayana-tomcat-all</artifactId>
    <version>1.0.0.Final</version>
    <packaging>pom</packaging>
    <name>Narayana: Tomcat integration</name>
    <properties>
        <version.org.apache.tomcat>9.0.11</version.org.apache.tomcat>
        <version.org.jboss.narayana>5.8.2.Final</version.org.jboss.narayana>
        <version.org.jboss.spec.javax.transaction>1.0.0.Final</version.org.jboss.spec.javax.transaction>
        <version.org.jboss.logging.jboss-logging>3.2.1.Final</version.org.jboss.logging.jboss-logging>
        <version.org.jboss.byteman>4.0.4</version.org.jboss.byteman>
        <version.org.jboss.jboss-transaction-spi>7.6.0.Final</version.org.jboss.jboss-transaction-spi>
        <version.org.jboss.resteasy>3.1.4.Final</version.org.jboss.resteasy>
        <version.org.jboss.arquillian.core>1.1.7.Final</version.org.jboss.arquillian.core>
        <version.org.jboss.arquillian.container.tomcat>1.1.0.Final</version.org.jboss.arquillian.container.tomcat>
        <version.org.jboss.shrinkwrap.resolver>2.2.2</version.org.jboss.shrinkwrap.resolver>
        <version.junit>4.11</version.junit>
        <version.javax.servlet>3.0.1</version.javax.servlet>
        <version.com.h2database>1.4.195</version.com.h2database>
        <version.postgresql>9.0-801.jdbc4</version.postgresql>
        <version.com.github.docker-java>3.0.14</version.com.github.docker-java>
        <version.org.sonatype.plugins.nexus-staging-maven-plugin>1.6.6</version.org.sonatype.plugins.nexus-staging-maven-plugin>
        <version.checkstyle>8.5</version.checkstyle>
        <version.org.wildfly.checkstyle-config>1.0.7.Final</version.org.wildfly.checkstyle-config>
        <version.org.jacoco>0.8.2</version.org.jacoco>

        <!-- Checkstyle configuration -->
        <linkXRef>false</linkXRef>

        <!-- jvm args -->
        <jvm.args.jacoco>
            -javaagent:${project.build.directory}/lib/jacocoagent.jar=destfile=${project.build.directory}/coverage-reports/jacoco-ut.exec,includes=*,append=true,output=file
        </jvm.args.jacoco>
        <jvm.args.jdk9/>
    </properties>
    <modules>
        <module>tools</module>
        <module>tomcat-jta</module>
    </modules>
    <build>
        <plugins>
            <plugin>
                <inherited>false</inherited>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${version.org.sonatype.plugins.nexus-staging-maven-plugin}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${version.checkstyle.plugin}</version>
                <executions>
                    <execution>
                        <id>check-style</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.wildfly.checkstyle</groupId>
                        <artifactId>wildfly-checkstyle-config</artifactId>
                        <version>${version.org.wildfly.checkstyle-config}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <excludes>**/*$logger.java,**/*$bundle.java</excludes>
                    <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                    <useFile></useFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.wildfly.checkstyle</groupId>
            <artifactId>wildfly-checkstyle-config</artifactId>
            <version>${version.org.wildfly.checkstyle-config}</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-install-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-install</id>
                                <phase>install</phase>
                            </execution>
                        </executions>
                        <inherited>false</inherited>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>codeCoverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${version.org.jacoco}</version>
                        <executions>
                            <!--
                            Prepares the property pointing to the JaCoCo runtime agent which
                            is passed as VM argument when Maven the Surefire plugin is executed.
                            -->
                            <execution>
                                <id>pre-unit-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <!-- Sets the path to the file which contains the execution data. -->
                                    <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                                    <!--
                                    Sets the name of the property containing the settings
                                    for JaCoCo runtime agent.
                                    -->
                                    <propertyName>surefireArgLine</propertyName>
                                </configuration>
                            </execution>
                            <!--
                            Ensures that the code coverage report for unit tests is created after
                            unit tests have been run.
                            -->
                            <execution>
                                <id>post-integration-test</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <!-- Sets the path to the file which contains the execution data. -->
                                    <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                                    <!-- Sets the output directory for the code coverage report. -->
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>check</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                                    <rules>
                                        <rule>
                                            <element>BUNDLE</element>
                                            <excludes>
                                                <exclude>*Test</exclude>
                                            </excludes>
                                            <limits>
                                                <limit>
                                                    <counter>INSTRUCTION</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>0.0</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${surefireArgLine} ${jvm.args.jdk9} -Djdk.attach.allowAttachSelf=true -Xss2048k</argLine>
                            <systemProperties>
                                <property>
                                    <name>com.arjuna.ats.arjuna.common.propertiesFile</name>
                                    <value>jbossts-properties.xml</value>
                                </property>
                            </systemProperties>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-jacoco-agent</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <stripVersion>true</stripVersion>
                                    <includeGroupIds>org.jacoco</includeGroupIds>
                                    <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.jacoco</groupId>
                    <artifactId>org.jacoco.agent</artifactId>
                    <version>${version.org.jacoco}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
