<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright The Narayana Authors
   SPDX short identifier: Apache-2.0
 -->

<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/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.jboss.narayana</groupId>
        <artifactId>narayana-all</artifactId>
        <version>7.2.2.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>jbosstxbridge</artifactId>
    <name>Narayana: txbridge</name>
    <description>Narayana: txbridge</description>
    <packaging>jar</packaging>
    <properties>
        <byteman.home>${project.build.directory}/byteman</byteman.home>
        <byteman.server.jvm.args>
            -Dorg.jboss.byteman.debug=true -Dorg.jboss.byteman.verbose=true
            -Dorg.jboss.byteman.contrib.dtest.rmiregistry.port=1199
            -Djboss.modules.system.pkgs=org.jboss.byteman
            -javaagent:${byteman.home}/byteman.jar=port:9091,listener:true,sys:${byteman.home}/byteman-dtest.jar
        </byteman.server.jvm.args>
        <server.jvm.args>
            ${jvm.args.other} ${jvm.args.memory} ${byteman.server.jvm.args} ${jvm.args.debug} ${jvm.args.modular}
        </server.jvm.args>
        <checkstyle.skip>true</checkstyle.skip>
        <sortpom.skip>true</sortpom.skip>
    </properties>
    <build>
        <plugins>
            <plugin>
                <inherited>false</inherited>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>byteman.copy</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.byteman</groupId>
                                    <artifactId>byteman</artifactId>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.jboss.byteman</groupId>
                                    <artifactId>byteman-dtest</artifactId>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${byteman.home}</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>create-disabled-context-propagation-configuration</id>
                        <phase>process-test-sources</phase>
                        <configuration>
                            <skip>true</skip>
                            <target unless="skipTests">
                                <copy
                                        file="${env.JBOSS_HOME}/standalone/configuration/standalone-xts.xml"
                                        tofile="${env.JBOSS_HOME}/standalone/configuration/test-disabled-context-propagation-standalone-xts.xml"/>
                                <replaceregexp
                                        match="&lt;default-context-propagation enabled=&quot;true&quot;/&gt;"
                                        replace="&lt;default-context-propagation enabled=&quot;false&quot;/&gt;"
                                        file="${env.JBOSS_HOME}/standalone/configuration/test-disabled-context-propagation-standalone-xts.xml"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>delete-disabled-context-propagation-configuration</id>
                        <phase>test</phase>
                        <configuration>
                            <skip>true</skip>
                            <target unless="skipTests">
                                <delete
                                        file="${env.JBOSS_HOME}/standalone/configuration/test-disabled-context-propagation-standalone-xts.xml"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${env.JBOSS_HOME}/standalone/configuration</directory>
                            <includes>
                                <include>test-disabled-context-propagation-standalone-xts.xml</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <inherited>false</inherited>
                <groupId>org.jboss.byteman</groupId>
                <artifactId>byteman-rulecheck-maven-plugin</artifactId>
                <configuration>
                    <packages>
                        <package>org.jboss.jbossts.xts.recovery.participant.at</package>
                    </packages>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-dependency-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.1,)
                                        </versionRange>
                                        <goals>
                                            <goal>copy</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <!--
                                This test is disabled due to the JVM crash.
                                And it is known JDK issue https://bugs.openjdk.java.net/browse/JDK-8210457
                            -->
                            <exclude>**/InboundCrashRecoveryTests.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.narayana</groupId>
                <artifactId>narayana-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.narayana</groupId>
                <artifactId>narayana-bom-test</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>jakarta.transaction</groupId>
            <artifactId>jakarta.transaction-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.narayana.xts</groupId>
            <artifactId>jbossxts</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.ws</groupId>
            <artifactId>jbossws-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.narayana.jta</groupId>
            <artifactId>narayana-jta</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-processor</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman-dtest</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.eclipse.parsson</groupId>
          <artifactId>parsson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jboss-transaction-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-ri</artifactId>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>

    </dependencies>
    <profiles>
        <profile>
            <id>arq</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <!-- Prevent test and server output appearing in console. -->
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                            <enableAssertions>true</enableAssertions>
                            <!-- Tests to execute. -->
                            <includes>
                                <include>**/*Tests.java</include>
                            </includes>
                            <!-- System properties passed to test cases -->
                            <systemPropertyVariables>
                                <!-- Used in arquillian.xml - arguments for all JBoss AS instances. -->
                                <server.jvm.args>${server.jvm.args}</server.jvm.args>
                                <java.rmi.server.codebase>file://target/test-classes/</java.rmi.server.codebase>
                                <node.address>localhost</node.address>
                            </systemPropertyVariables>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-disabled-context-propagation-configuration</id>
                                <configuration>
                                    <skip>${maven.test.skip}</skip>
                                </configuration>
                            </execution>
                            <execution>
                                <id>delete-disabled-context-propagation-configuration</id>
                                <configuration>
                                    <skip>${maven.test.skip}</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>arqIPv6</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <CLI_IPV6_OPTS>-Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true
                            </CLI_IPV6_OPTS>
                            <!-- Prevent test and server output appearing in console. -->
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                            <enableAssertions>true</enableAssertions>
                            <!-- Tests to execute. -->
                            <includes>
                                <include>**/*Tests.java</include>
                            </includes>
                            <!-- System properties passed to test cases -->
                            <systemPropertyVariables>
                                <!-- Used in arquillian.xml - arguments for all JBoss AS instances. -->
                                <server.jvm.args>${server.jvm.args} ${ipv6.server.jvm.args}</server.jvm.args>
                                <java.rmi.server.codebase>file://target/test-classes/</java.rmi.server.codebase>
                                <node.address>[::1]</node.address>
                            </systemPropertyVariables>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-disabled-context-propagation-configuration</id>
                                <configuration>
                                    <skip>${maven.test.skip}</skip>
                                </configuration>
                            </execution>
                            <execution>
                                <id>delete-disabled-context-propagation-configuration</id>
                                <configuration>
                                    <skip>${maven.test.skip}</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>codeCoverage</id>
            <properties>
                <server.jvm.args>
                    ${jvm.args.other} ${jvm.args.memory} ${byteman.server.jvm.args} ${jvm.args.debug} ${jvm.args.jacoco}
                    ${jvm.args.modular}
                </server.jvm.args>
            </properties>
        </profile>
        <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>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <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>
                            <source>8</source>
                            <detectOfflineLinks>false</detectOfflineLinks>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>