<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~
  ~ Copyright 2021 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ 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>

    <parent>
        <groupId>dev.resteasy.tools</groupId>
        <artifactId>resteasy-parent</artifactId>
        <version>2.0.3.Final</version>
        <relativePath/>
    </parent>

    <groupId>org.jboss.resteasy.microprofile</groupId>
    <artifactId>resteasy-microprofile-parent</artifactId>
    <version>3.0.1.Final</version>
    <packaging>pom</packaging>

    <url>https://jboss.org/resteasy</url>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/resteasy/resteasy-microprofile.git</connection>
        <developerConnection>scm:git:git@github.com:resteasy/resteasy-microprofile.git</developerConnection>
        <url>https://github.com/resteasy/resteasy-microprofile/tree/main/</url>
    </scm>

    <properties>
        <!-- Dependency versions, please keep in alphabetical order -->

        <version.jakarta.enterprise>4.0.1</version.jakarta.enterprise>
        <version.jakarta.servlet>6.0.0</version.jakarta.servlet>
        <version.jakarta.ws.rs>3.1.0</version.jakarta.ws.rs>

        <version.io.smallrye.smallrye-config>3.9.1</version.io.smallrye.smallrye-config>

        <version.org.eclipse.microprofile.rest.client>4.0</version.org.eclipse.microprofile.rest.client>
        <version.org.eclipse.microprofile.config>3.1</version.org.eclipse.microprofile.config>
        <version.org.eclipse.microprofile.context-propagation>1.3</version.org.eclipse.microprofile.context-propagation>

        <version.org.jboss.logging.jboss-logging>3.6.1.Final</version.org.jboss.logging.jboss-logging>
        <version.org.jboss.logging.jboss-logging-tools>3.0.3.Final</version.org.jboss.logging.jboss-logging-tools>
        <version.org.jboss.resteasy>6.2.11.Final</version.org.jboss.resteasy>

        <version.junit>4.13.2</version.junit>
        <version.org.junit>5.11.4</version.org.junit>

        <!-- Test only dependencies -->
        <version.org.wiremock>3.10.0</version.org.wiremock>

        <!-- Plugin Versions -->
        <version.org.wildfly.maven.plugin>5.1.1.Final</version.org.wildfly.maven.plugin>
        <version.org.wildfly.galleon-plugins>7.3.1.Final</version.org.wildfly.galleon-plugins>
        <version.org.wildfly.wildfly-channel-maven-plugin>1.0.19</version.org.wildfly.wildfly-channel-maven-plugin>

        <!-- Plugin Versions, please keep in alphabetical order -->
        <!-- print logs to file by default -->
        <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
        <!-- maven-enforcer-plugin -->
        <maven.min.version>3.6.0</maven.min.version>
        <!-- maven-surefire-plugin -->
        <surefire.system.args>-Xms512m -Xmx512m</surefire.system.args>

        <maven.test.skip>false</maven.test.skip>
        <skipTests>${maven.test.skip}</skipTests>
        <galleon.skip>${skipTests}</galleon.skip>
        <skip.format>false</skip.format>
        <skip.compile>false</skip.compile>

        <!-- Provisioning settings -->
        <!--suppress XmlUnresolvedReference these properties are created via the build-helper-maven-plugin -->
        <channel.stream.version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</channel.stream.version>

        <galleon.fork.embedded>true</galleon.fork.embedded>
        <galleon.log.time>true</galleon.log.time>
        <galleon.offline>false</galleon.offline>
    </properties>

    <modules>
        <module>bom/bom</module>
        <module>bom/project-bom</module>
        <module>bom/test-bom</module>
        <module>config</module>
        <module>rest-client-base</module>
        <module>rest-client</module>
        <module>context-propagation</module>
        <module>wildfly/resteasy-microprofile-channel</module>
        <module>testsuite</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <skip>${skip.compile}</skip>
                        <skipMain>${skip.compile}</skipMain>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>${version.org.wildfly.maven.plugin}</version>
                    <configuration>
                        <skip>${galleon.skip}</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.wildfly.galleon-plugins</groupId>
                    <artifactId>wildfly-galleon-maven-plugin</artifactId>
                    <version>${version.org.wildfly.galleon-plugins}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <argLine>${surefire.system.args}</argLine>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>check-style</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>ban-bad-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <searchTransitive>true</searchTransitive>
                                    <excludes>
                                        <exclude>javax.activation:activation</exclude>
                                        <exclude>javax.activation:javax.activation-api</exclude>
                                        <exclude>javax.enterprise:cdi-api</exclude>
                                        <exclude>javax.inject:javax.inject</exclude>
                                        <exclude>javax.json:javax.json-api</exclude>
                                        <exclude>javax.security.enterprise:javax.security.enterprise-api</exclude>
                                        <exclude>javax.servlet:servlet-api</exclude>
                                        <exclude>javax.transaction:jta</exclude>
                                        <exclude>javax.validation:validation-api</exclude>
                                        <exclude>javax.xml:jaxrpc-api</exclude>
                                        <exclude>javax.xml.bind:jaxb-api</exclude>
                                        <exclude>javax.xml.soap:saaj-api</exclude>
                                        <exclude>javax.xml.stream:stax-api</exclude>
                                        <exclude>log4j:log4j</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dep-convergence</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <dependencyConvergence/>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Change the channel.stream.version property to match the current project version major.minor -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>parse-version</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>sort-resource-imports</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>sort</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
                            <testSourceDirectory>${project.basedir}/src/test/resources</testSourceDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

    <profiles>
        <profile>
            <id>jdk.test</id>
            <activation>
                <property>
                    <name>test.java.home</name>
                </property>
                <file>
                    <exists>${test.java.home}</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-test</id>
                                <configuration>
                                    <jvm>${test.java.home}/bin/java</jvm>
                                    <environmentVariables>
                                        <JAVA_HOME>${test.java.home}</JAVA_HOME>
                                    </environmentVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>Windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <surefire.system.args>-Xms512m -Xmx512m -Djdk.io.File.enableADS=true</surefire.system.args>
                <additionalJvmArgs>-Djdk.io.File.enableADS=true</additionalJvmArgs>
            </properties>
        </profile>
        <profile>
            <id>format-check</id>
            <build>
                <plugins>
                    <!-- Validate formatting -->
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>validate-format</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>check-import-sort</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>check-import-sort-resources</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
                                    <testSourceDirectory>${project.basedir}/src/test/resources</testSourceDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <!-- Required for provisioning WildFly. Not all dependencies currently exist on Maven Central. This is also
             useful for when we want to test with versions releases that have not yet been synchronized to Maven Central
             from JBoss Nexus.
         -->
        <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
            <id>jboss-public-repository-group</id>
            <name>JBoss Public Repository Group</name>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
            <layout>default</layout>
        </repository>
    </repositories>

</project>
