<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2011-2014 The original author or authors
  ~
  ~  All rights reserved. This program and the accompanying materials
  ~  are made available under the terms of the Eclipse Public License v1.0
  ~  and Apache License v2.0 which accompanies this distribution.
  ~
  ~      The Eclipse Public License is available at
  ~      http://www.eclipse.org/legal/epl-v10.html
  ~
  ~      The Apache License v2.0 is available at
  ~      http://www.opensource.org/licenses/apache2.0.php
  ~
  ~  You may elect to redistribute this code under either of these licenses.
  -->

<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>io.vertx</groupId>
    <artifactId>vertx-parent</artifactId>
    <version>9</version>
  </parent>

  <artifactId>vertx-core</artifactId>
  <version>3.3.2</version>

  <name>Vert.x Core</name>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
    <license>
      <name>Eclipse Public License - v 1.0</name>
      <url>http://www.eclipse.org/legal/epl-v10.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:eclipse/vert.x.git</connection>
    <developerConnection>scm:git:git@github.com:eclipse/vert.x.git</developerConnection>
    <url>git@github.com:eclipse/vert.x.git</url>
  </scm>

  <properties>

    <netty.version>4.1.1.Final</netty.version>
    <jackson.version>2.7.4</jackson.version>
    <log4j.version>1.2.17</log4j.version>
    <slf4j.version>1.7.21</slf4j.version>
    <log4j2.version>2.5</log4j2.version>
    <junit.version>4.12</junit.version>
    <assertj.version>3.4.1</assertj.version>
    <apacheds-protocol-dns.version>1.5.7</apacheds-protocol-dns.version>
    <generated.dir>${project.basedir}/src/main/generated</generated.dir>
    <stack.version>3.3.2</stack.version>
    <jetty.alpnAgent.version>2.0.3</jetty.alpnAgent.version>
    <jetty.alpnAgent.path>${settings.localRepository}/org/mortbay/jetty/alpn/jetty-alpn-agent/${jetty.alpnAgent.version}/jetty-alpn-agent-${jetty.alpnAgent.version}.jar</jetty.alpnAgent.path>

  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-dependencies</artifactId>
        <version>${stack.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- We depend on the specific Netty dependencies not netty-all to reduce the size of fatjars -->
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-common</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-buffer</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-transport</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-handler</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-handler-proxy</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec-http</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec-http2</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-resolver</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-resolver-dns</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>${log4j.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.directory.server</groupId>
      <artifactId>apacheds-protocol-dns</artifactId>
      <version>${apacheds-protocol-dns.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mortbay.jetty.alpn</groupId>
      <artifactId>jetty-alpn-agent</artifactId>
      <version>${jetty.alpnAgent.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-tcnative-boringssl-static</artifactId>
      <version>1.1.33.Fork17</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <executions>
            <execution>
              <id>default-compile</id>
              <configuration>
                <annotationProcessors>
                  <annotationProcessor>io.vertx.docgen.JavaDocGenProcessor</annotationProcessor>
                  <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
                </annotationProcessors>
                <compilerArgs>
                  <arg>-Adocgen.output=${asciidoc.dir}/java</arg>
                  <arg>-AoutputDirectory=${project.basedir}/src/main</arg>
                  <arg>-Amaven.groupId=${project.groupId}</arg>
                  <arg>-Amaven.artifactId=${project.artifactId}</arg>
                  <arg>-Amaven.version=${project.version}</arg>
                </compilerArgs>
                <generatedSourcesDirectory>${generated.dir}</generatedSourcesDirectory>
              </configuration>
            </execution>
            <execution>
              <id>default-testCompile</id>
              <configuration>
                <annotationProcessors>
                  <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
                </annotationProcessors>
                <compilerArgs>
                  <arg>-AoutputDirectory=${project.basedir}/src/test</arg>
                </compilerArgs>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven.surefire.plugin.version}</version>
          <configuration>
            <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
            <additionalClasspathElements>
              <additionalClasspathElement>${project.build.testSourceDirectory}</additionalClasspathElement>
              <additionalClasspathElement>${basedir}/src/test/resources/webroot2.jar</additionalClasspathElement>
              <additionalClasspathElement>${basedir}/src/test/resources/webroot5.zip</additionalClasspathElement>
            </additionalClasspathElements>
            <systemPropertyVariables>
              <io.netty.leakDetectionLevel>PARANOID</io.netty.leakDetectionLevel>
              <buildDirectory>${project.build.directory}</buildDirectory>
              <vertxVersion>${project.version}</vertxVersion>
              <vertx.handle100Continue>true</vertx.handle100Continue>
            </systemPropertyVariables>
            <!-- Needs to be small enough to run in a EC2 1.7GB small instance -->
            <!-- IMPORTANT: when modifying this line, don't forge to modify the same line in the`coverage` profile -->
            <argLine>-Xmx1200M -javaagent:${jetty.alpnAgent.path}</argLine>
            <forkCount>1</forkCount>
            <reuseForks>true</reuseForks>
            <excludes>
              <exclude>io/vertx/test/it/**</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>process-asciidoc</goal>
              </goals>
              <phase>package</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <reportOutputDirectory>${project.build.directory}/docs</reportOutputDirectory>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <executions>
            <execution>
              <id>default-clean</id>
              <configuration>
                <filesets>
                  <fileset>
                    <directory>${asciidoc.dir}</directory>
                    <directory>${generated.dir}</directory>
                  </fileset>
                </filesets>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <executions>
            <execution>
              <id>attach-sources</id>
              <configuration>
                <excludes>
                  <exclude>docoverride/**</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
        </plugin>


      </plugins>
    </pluginManagement>
    <plugins>

      <!-- Tests that require to run with different JVM settings -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.19.1</version>
        <executions>
          <execution>
            <id>no-alpn</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <includes>
                <include>io/vertx/test/it/SSLEngineTest.java</include>
              </includes>
              <systemProperties>
                <vertx-test-alpn-jdk>false</vertx-test-alpn-jdk>
                <vertx-test-alpn-openssl>false</vertx-test-alpn-openssl>
              </systemProperties>
              <classpathDependencyExcludes>
                <classpathDependencyExclude>io.netty:netty-tcnative-boringssl-static</classpathDependencyExclude>
              </classpathDependencyExcludes>
            </configuration>
          </execution>
          <execution>
            <id>openssl-alpn</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <includes>
                <include>io/vertx/test/it/SSLEngineTest.java</include>
              </includes>
              <systemProperties>
                <vertx-test-alpn-jdk>false</vertx-test-alpn-jdk>
                <vertx-test-alpn-openssl>true</vertx-test-alpn-openssl>
                <vertx-test-sslcontext>openssl</vertx-test-sslcontext>
              </systemProperties>
            </configuration>
          </execution>
          <execution>
            <id>jdk-alpn</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <argLine>-javaagent:${jetty.alpnAgent.path}</argLine>
              <includes>
                <include>io/vertx/test/it/SSLEngineTest.java</include>
              </includes>
              <systemProperties>
                <vertx-test-alpn-jdk>true</vertx-test-alpn-jdk>
                <vertx-test-alpn-openssl>false</vertx-test-alpn-openssl>
                <vertx-test-sslcontext>jdk</vertx-test-sslcontext>
              </systemProperties>
              <classpathDependencyExcludes>
                <classpathDependencyExclude>io.netty:netty-tcnative-boringssl-static</classpathDependencyExclude>
              </classpathDependencyExcludes>
            </configuration>
          </execution>
          <execution>
            <id>jdk-openssl-alpn</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <argLine>-javaagent:${jetty.alpnAgent.path}</argLine>
              <includes>
                <include>io/vertx/test/it/SSLEngineTest.java</include>
              </includes>
              <systemProperties>
                <vertx-test-alpn-jdk>true</vertx-test-alpn-jdk>
                <vertx-test-alpn-openssl>true</vertx-test-alpn-openssl>
                <vertx-test-sslcontext>jdk</vertx-test-sslcontext>
              </systemProperties>
            </configuration>
          </execution>
          <execution>
            <id>slf4j</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <includes>
                <include>io/vertx/test/it/SLF4JLogDelegateTest.java</include>
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>jul</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <includes>
                <include>io/vertx/test/it/JULLogDelegateTest.java</include>
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>log4j2</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <includes>
                <include>io/vertx/test/it/Log4J2LogDelegateTest.java</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Transform the Asciidoctor to html -->
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>javadoc</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>assemble-docs</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>true</attach>
              <descriptors>
                <descriptor>src/main/assembly/docs.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <configuration>
              <archive>
                <!-- Generate a jar INDEX.LIST -->
                <index>true</index>
                <!-- A manifest containing the OSGi metadata has been generated using the maven-bundle-plugin -->
                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                <!-- Add the Maven coordinates in the manifest -->
                <manifestEntries>
                  <Maven-Group-Id>${project.groupId}</Maven-Group-Id>
                  <Maven-Artifact-Id>${project.artifactId}</Maven-Artifact-Id>
                  <Maven-Version>${project.version}</Maven-Version>
                </manifestEntries>
              </archive>
              <!-- Remove examples and docoverride -->
              <excludes>
                <exclude>/docoverride/**</exclude>
                <exclude>/examples/**</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.5.3</version>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
            <configuration>
              <instructions>
                <Export-Package>io.vertx.core*</Export-Package>
                <Private-Package>!docoverride*, !examples*</Private-Package>
                <Import-Package>org.slf4j*;resolution:=optional,
                  org.apache.log4j;resolution:=optional,
                  org.apache.logging.log4*;resolution:=optional,
                  *
                </Import-Package>
              </instructions>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/vertx-version.txt</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/vertx-version.txt</exclude>
        </excludes>
      </resource>
    </resources>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.7</version>
        <reportSets>
          <reportSet>
            <reports>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>coverage</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <argLine>-Xmx1200M @{surefireArgLine} -javaagent:${jetty.alpnAgent.path}</argLine>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>

</project>
