<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2012 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>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>35</version>
    </parent>

    <groupId>io.undertow</groupId>
    <artifactId>undertow-parent</artifactId>
    <version>2.2.22.Final</version>

    <name>Undertow</name>
    <description>Undertow</description>

    <packaging>pom</packaging>

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

    <scm>
        <connection>scm:git://github.com/undertow-io/undertow.git</connection>
        <developerConnection>scm:git://github.com/undertow-io/undertow.git</developerConnection>
        <url>https://github.com/undertow-io/undertow</url>
    </scm>

    <properties>
        <!--
            Dependency versions. Please keep alphabetical.

            Each version property should be of the form "version.<groupId>".
            For example: <version.org.jboss.as>

            In cases where multiple artifacts use the same groupId but have different
            versions, add the artifactId or other qualifier to the property name.
            For example: <version.org.jboss.as.console>
         -->
        <version.com.h2database>1.4.200</version.com.h2database>
        <version.easymock>4.2</version.easymock>
        <version.junit>4.13</version.junit>
        <version.netty>4.1.50.Final</version.netty>
        <version.org.apache.directory.server>2.0.0-M15</version.org.apache.directory.server>
        <version.org.apache.httpcomponents>4.5.12</version.org.apache.httpcomponents>
        <version.org.jboss.classfilewriter>1.2.4.Final</version.org.jboss.classfilewriter>
        <version.org.jboss.logging>3.4.1.Final</version.org.jboss.logging>
        <version.org.jboss.logging.processor>2.2.1.Final</version.org.jboss.logging.processor>
        <version.org.jboss.logmanager>2.1.14.Final</version.org.jboss.logmanager>
        <version.org.jboss.spec.javax.annotation.jboss-annotations-api_1.3_spec>2.0.1.Final</version.org.jboss.spec.javax.annotation.jboss-annotations-api_1.3_spec>
        <version.org.jboss.spec.javax.servlet.jboss-servlet-api_4.0_spec>2.0.0.Final</version.org.jboss.spec.javax.servlet.jboss-servlet-api_4.0_spec>
        <version.org.jboss.spec.javax.websockets>2.0.0.Final</version.org.jboss.spec.javax.websockets>
        <version.xnio>3.8.7.Final</version.xnio>
        <!-- TODO remove this dependency once xnio upgrades to latest jboss threads -->
        <version.org.jboss.threads>3.1.0.Final</version.org.jboss.threads>
        <version.org.wildfly.common>1.5.4.Final</version.org.wildfly.common>
        <version.org.wildfly.client-config>1.0.1.Final</version.org.wildfly.client-config>

        <!-- jacoco -->
        <version.org.jacoco>0.7.9</version.org.jacoco>
        <jacoco.agent.argLine></jacoco.agent.argLine>

        <!-- Spotbugs properties -->
        <spotbugs.exclude.filter.file>../spotbugs-exclude.xml</spotbugs.exclude.filter.file>

        <!-- Surefire args -->
        <surefire.jpda.args/>
        <surefire.system.args>-ea ${surefire.jpda.args} -Xmx1024m</surefire.system.args>
        <!--by default run all tests-->
        <test.categories>io.undertow.testutils.category.UnitTest OR NOT io.undertow.testutils.category.UnitTest</test.categories>

        <!-- Checkstyle configuration -->
        <linkXRef>false</linkXRef>
        <version.io.undertow.build.checkstyle-config>1.0.1.Final</version.io.undertow.build.checkstyle-config>
        <version.com.github.spotbugs-maven-plugin>3.1.7</version.com.github.spotbugs-maven-plugin>
        <version.org.eclipse.jetty.alpn>1.1.3.v20160715</version.org.eclipse.jetty.alpn>

        <version.com.twitter.hpack>1.0.2</version.com.twitter.hpack>

        <!-- Non-default maven plugin versions and configuration -->
        <version.org.wildfly.openssl>1.0.4.Final</version.org.wildfly.openssl>
        <version.checkstyle>7.1</version.checkstyle>
        <version.bundle.plugin>5.1.1</version.bundle.plugin>

        <version.jmh>1.21</version.jmh>
    </properties>

    <modules>
        <module>parser-generator</module>
        <module>core</module>
        <module>servlet</module>
        <module>examples</module>
        <module>websockets-jsr</module>
        <module>benchmarks</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!--
                        The Javadoc comments contain a lot of warnings
                        that add a lot of noise to the build without the
                        following setting.
                    -->
                    <doclint>none</doclint>
                    <!-- @implNote is a non-standard tag and must be declared or the build will fail -->
                    <tags>
                        <tag>
                            <name>implNote</name>
                            <placement>a</placement>
                            <head>Implementation Note:</head>
                        </tag>
                    </tags>
                    <source>1.8</source> 
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            <!-- Zanata translations -->
            <plugin>
                <groupId>org.zanata</groupId>
                <artifactId>zanata-maven-plugin</artifactId>
                <version>${version.zanata.plugin}</version>
                <configuration>
                    <!-- Process sub-modules separately, sharing parent config -->
                    <enableModules>true</enableModules>
                    <projectConfig>${session.executionRootDirectory}/zanata.xml</projectConfig>
                    <!-- Generated English i18n.properties are written here: -->
                    <srcDir>target/classes</srcDir>
                    <transDir>src/main/resources</transDir>
                    <includes>**/*.i18n.properties,**/LocalDescriptions.properties</includes>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>

                <!-- Checkstyle -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.checkstyle.plugin}</version>
                    <configuration>
                        <configLocation>undertow-checkstyle/checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <useFile/>
                        <sourceDirectories>
                            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                        </sourceDirectories>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>io.undertow.build</groupId>
                            <artifactId>undertow-checkstyle-config</artifactId>
                            <version>${version.io.undertow.build.checkstyle-config}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>check-style</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- FindBugs -->
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${version.com.github.spotbugs-maven-plugin}</version>
                    <configuration>
                        <excludeFilterFile>${spotbugs.exclude.filter.file}</excludeFilterFile>
                    </configuration>
                    <executions>
                        <execution>
                            <id>find-bugs</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <configuration>
                        <groups>${test.categories}</groups>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    </configuration>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <!--suppress MavenModelInspection -->
                    <groupId>org.eclipse.m2e</groupId>
                    <!--suppress MavenModelInspection -->
                    <artifactId>lifecycle-mapping</artifactId>
                    <!--suppress MavenModelInspection -->
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-checkstyle-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.5,)
                                        </versionRange>
                                        <goals>
                                            <goal>checkstyle</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>${version.bundle.plugin}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencyManagement>
        <dependencies>

            <!-- Modules in this project -->

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-core</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-core</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-examples</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-parser-generator</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-servlet</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-servlet</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-websockets-jsr</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-benchmarks</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- External Dependencies -->

            <dependency>
                <groupId>io.undertow.build</groupId>
                <artifactId>undertow-checkstyle-config</artifactId>
                <version>${version.io.undertow.build.checkstyle-config}</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.classfilewriter</groupId>
                <artifactId>jboss-classfilewriter</artifactId>
                <version>${version.org.jboss.classfilewriter}</version>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${version.junit}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.eclipse.jetty.alpn</groupId>
                <artifactId>alpn-api</artifactId>
                <version>${version.org.eclipse.jetty.alpn}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.easymock</groupId>
                <artifactId>easymock</artifactId>
                <version>${version.easymock}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-all</artifactId>
                <version>${version.netty}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>com.twitter</groupId>
                <artifactId>hpack</artifactId>
                <version>${version.com.twitter.hpack}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.directory.server</groupId>
                <artifactId>apacheds-all</artifactId>
                <version>${version.org.apache.directory.server}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${version.org.apache.httpcomponents}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpmime</artifactId>
                <version>${version.org.apache.httpcomponents}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging</artifactId>
                <version>${version.org.jboss.logging}</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging-processor</artifactId>
                <version>${version.org.jboss.logging.processor}</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.logmanager</groupId>
                <artifactId>jboss-logmanager</artifactId>
                <version>${version.org.jboss.logmanager}</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.spec.javax.annotation</groupId>
                <artifactId>jboss-annotations-api_1.3_spec</artifactId>
                <version>${version.org.jboss.spec.javax.annotation.jboss-annotations-api_1.3_spec}</version>
            </dependency>

            <!-- TODO: replace with JBoss Spec Artifact-->
            <dependency>
                <groupId>org.jboss.spec.javax.servlet</groupId>
                <artifactId>jboss-servlet-api_4.0_spec</artifactId>
                <version>${version.org.jboss.spec.javax.servlet.jboss-servlet-api_4.0_spec}</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.spec.javax.websocket</groupId>
                <artifactId>jboss-websocket-api_1.1_spec</artifactId>
                <version>${version.org.jboss.spec.javax.websockets}</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.xnio</groupId>
                <artifactId>xnio-api</artifactId>
                <version>${version.xnio}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.jboss.threads</groupId>
                        <artifactId>jboss-threads</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.jboss.xnio</groupId>
                <artifactId>xnio-nio</artifactId>
                <version>${version.xnio}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.wildfly.common</groupId>
                        <artifactId>wildfly-common</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.jboss.threads</groupId>
                <artifactId>jboss-threads</artifactId>
                <version>${version.org.jboss.threads}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.wildfly.common</groupId>
                        <artifactId>wildfly-common</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.wildfly.common</groupId>
                <artifactId>wildfly-common</artifactId>
                <version>${version.org.wildfly.common}</version>
            </dependency>

            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${version.com.h2database}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.wildfly.openssl</groupId>
                <artifactId>wildfly-openssl</artifactId>
                <version>${version.org.wildfly.openssl}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-core</artifactId>
                <version>${version.jmh}</version>
            </dependency>

            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-generator-annprocess</artifactId>
                <version>${version.jmh}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.wildfly.extras.batavia</groupId>
                <artifactId>transformer-api</artifactId>
                <version>${version.org.wildfly.extras.batavia}</version>
            </dependency>

            <dependency>
                <groupId>org.wildfly.extras.batavia</groupId>
                <artifactId>transformer-impl-eclipse</artifactId>
                <version>${version.org.wildfly.extras.batavia}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>spotbugs</id>
            <activation>
                <property>
                    <name>findbugs</name> <!-- not modified just for compatibility reason -->
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Temporary profile to workaround issue described here https://github.com/spotbugs/spotbugs/issues/756. -->
            <id>spotbugs-jdk11</id>
            <activation>
                <jdk>11</jdk>
                <property>
                    <name>findbugs</name> <!-- not modified just for compatibility reason -->
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <configuration>
                            <failOnError>false</failOnError>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jdk9</id>
            <activation>
                <jdk>9</jdk>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <version>${version.compiler.plugin}</version>
                            <configuration>
                                <!-- fork is needed so compiler args can be used -->
                                <fork>true</fork>
                                <failOnError>false</failOnError>
                                <compilerArgs>
                                    <arg>-J--add-opens=java.base/java.lang=ALL-UNNAMED</arg>
                                </compilerArgs>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>dist</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <modules>
                <module>dist</module>
            </modules>
        </profile>

        <profile>
            <id>test-coverage</id>
            <modules>
                <module>coverage-report</module>
            </modules>
            <properties>
                <jacoco.agent.argLine>${jacoco.activated.agent.argLine}</jacoco.agent.argLine>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${version.org.jacoco}</version>
                        <executions>
                            <execution>
                                <id>agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>io.undertow*</include>
                                    </includes>
                                    <propertyName>jacoco.activated.agent.argLine</propertyName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>only-unit-tests</id>
            <activation>
                <property>
                    <name>onlyUnitTests</name>
                </property>
            </activation>
            <properties>
                <test.categories>io.undertow.testutils.category.UnitTest</test.categories>
            </properties>
        </profile>

        <profile>
            <id>skip-unit-tests</id>
            <activation>
                <property>
                    <name>skipUnitTests</name>
                </property>
            </activation>
            <properties>
                <test.categories>NOT io.undertow.testutils.category.UnitTest</test.categories>
            </properties>
        </profile>

        <profile>
            <id>osgi</id>
            <activation>
                <property>
                    <name>osgi</name>
                </property>
            </activation>
            <modules>
                <module>karaf</module>
            </modules>
        </profile>
    </profiles>

</project>
