<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">

  <name>Extensions on Apache Proton-J library</name>
  <description>Extensions on Apache Proton-J library</description>
  <url>https://github.com/Azure/qpid-proton-j-extensions</url>
  <organization>
    <name>Microsoft Corporation</name>
    <url>http://microsoft.com</url>
  </organization>

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>qpid-proton-j-extensions</artifactId>
  <version>1.2.6</version>

  <licenses>
    <license>
      <name>The MIT License (MIT)</name>
      <url>http://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>microsoft</id>
      <name>Microsoft Corporation</name>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/Azure/qpid-proton-j-extensions</url>
    <connection>scm:git:https://github.com/Azure/qpid-proton-j-extensions.git</connection>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/Azure/qpid-proton-j-extensions/issues</url>
  </issueManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <packageOutputDirectory>${project.build.directory}</packageOutputDirectory>
  </properties>

  <build>
    <plugins>
      <!-- Configure checkstyle plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.6.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-checkstyle-plugin;external_dependency} -->
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Configure spotbugs to run in verify -->
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.8.3.1</version> <!-- {x-version-update;com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Configure the jar plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.4.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-jar-plugin;external_dependency} -->
        <configuration>
          <archive>
            <manifestEntries>
              <Automatic-Module-Name>com.microsoft.azure.qpid.protonj.extensions</Automatic-Module-Name>
            </manifestEntries>
          </archive>
          <outputDirectory>${packageOutputDirectory}</outputDirectory>
        </configuration>
      </plugin>

      <!-- Configure the source plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-source-plugin;external_dependency} -->
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <outputDirectory>${packageOutputDirectory}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Configure the javadoc plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.10.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <!-- This plugin configures the bas requirements for compilation -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.13.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
          <configuration>
            <showWarnings>true</showWarnings>
            <failOnWarning>true</failOnWarning>
            <compilerArgs combine.children="append" combine.self="append">
              <!-- Turn off annotation processing -->
              <arg>-proc:none</arg>

              <!-- https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#xlintwarnings -->
              <arg>-Xlint:cast</arg>
              <arg>-Xlint:classfile</arg>
              <arg>-Xlint:deprecation</arg>
              <arg>-Xlint:dep-ann</arg>
              <arg>-Xlint:divzero</arg>
              <arg>-Xlint:empty</arg>
              <arg>-Xlint:fallthrough</arg>
              <arg>-Xlint:finally</arg>
              <arg>-Xlint:options</arg>
              <arg>-Xlint:overrides</arg>
              <arg>-Xlint:path</arg>
              <!-- <arg>-Xlint:processing</arg> -->
              <arg>-Xlint:rawtypes</arg>
              <!-- <arg>-Xlint:serial</arg> -->
              <arg>-Xlint:static</arg>
              <arg>-Xlint:try</arg>
              <arg>-Xlint:unchecked</arg>
              <arg>-Xlint:varargs</arg>
            </compilerArgs>
          </configuration>
        </plugin>

        <!-- This plugin scans checkstyle issues in the code -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.6.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-checkstyle-plugin;external_dependency} -->
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>9.3</version> <!-- {x-version-update;com.puppycrawl.tools:checkstyle;external_dependency} -->
            </dependency>
          </dependencies>
          <configuration>
            <configLocation>eng/checkstyle/checkstyle.xml</configLocation>
            <suppressionsLocation>eng/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
            <consoleOutput>true</consoleOutput>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <linkXRef>true</linkXRef>
            <failsOnError>true</failsOnError>
            <failOnViolation>true</failOnViolation>
          </configuration>
        </plugin>

        <!-- This plugin generates Javadocs -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.10.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
          <configuration>
            <source>1.8</source>
            <doctitle>Extensions on Apache Proton-J Reference Documentation</doctitle>
            <windowtitle>Extensions on Apache Proton-J Reference Documentation</windowtitle>
            <jarOutputDirectory>${packageOutputDirectory}</jarOutputDirectory>
            <failOnError>true</failOnError>
            <failOnWarnings>true</failOnWarnings>
            <doclint>all</doclint>
            <detectJavaApiLink>true</detectJavaApiLink>

            <excludePackageNames>
              *.impl*
            </excludePackageNames>
          </configuration>
        </plugin>

        <!-- This plugin runs tests -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-surefire-plugin;external_dependency} -->
          <configuration>
            <runOrder>alphabetical</runOrder>
            <useSystemClassLoader>false</useSystemClassLoader>
            <forkCount>1</forkCount>
            <testFailureIgnore>false</testFailureIgnore>
          </configuration>
        </plugin>

        <!-- Spotbugs -->
        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>4.8.3.1</version> <!-- {x-version-update;com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
          <dependencies>
            <dependency>
              <groupId>com.github.spotbugs</groupId>
              <artifactId>spotbugs</artifactId>
              <version>4.8.3</version> <!-- {x-version-update;com.github.spotbugs:spotbugs;external_dependency} -->
            </dependency>
          </dependencies>
          <configuration>
            <effort>max</effort>
            <threshold>Low</threshold>
            <xmlOutput>true</xmlOutput>
            <excludeFilterFile>eng/spotbugs/spotbugs-excludes.xml</excludeFilterFile>
            <failOnError>true</failOnError>
            <fork>true</fork>

            <!-- TODO (conniey): https://github.com/Azure/qpid-proton-j-extensions/issues/44 -->
            <includeTests>false</includeTests>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.20.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-site-plugin;external_dependency} -->
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.8.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-project-info-reports-plugin;external_dependency} -->
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.10.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
      </plugin>

      <!-- This plugin runs spotbugs. -->
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.8.3.1</version> <!-- {x-version-update;com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
        <configuration>
          <xmlOutputDirectory>target/site</xmlOutputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <dependencies>
    <!-- Product dependencies -->
    <dependency>
      <groupId>org.apache.qpid</groupId>
      <artifactId>proton-j</artifactId>
      <version>0.34.1</version> <!-- {x-version-update;org.apache.qpid:proton-j;external_dependency} -->
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-api;external_dependency} -->
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version> <!-- {x-version-update;junit:junit;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>5.11.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>4.11.0</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <!-- By default, we build against our baseline, Java 11, but we also want to ensure compatibility against the latest
        Java 8 LTS release. The default 'java11', which will perform a build using Java 11 as its target. -->
    <profile>
      <id>java8</id>
      <activation>
        <jdk>[1.8,9)</jdk>
      </activation>
      <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
      </properties>
      <build>
        <plugins>
          <!-- Don't compile module-info.java, see java 9+ profile -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.13.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <excludes>
                <exclude>module-info.java</exclude>
              </excludes>
            </configuration>
          </plugin>

          <!-- javadoc: Avoid errors from module-info -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.10.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
            <configuration>
              <sourceFileExcludes>
                <sourceFileExclude>module-info.java</sourceFileExclude>
              </sourceFileExcludes>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <reporting>
        <plugins>
          <!-- javadoc: Avoid errors from module-info.java -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.10.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
            <configuration>
              <sourceFileExcludes>
                <sourceFileExclude>module-info.java</sourceFileExclude>
              </sourceFileExcludes>
            </configuration>
          </plugin>
        </plugins>
      </reporting>
    </profile>

    <profile>
      <id>java-lts</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>[11,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.13.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
            <configuration>
              <testRelease>11</testRelease>
              <compilerArgs combine.children="append">
                <arg>-Xlint:-module</arg> <!-- FIXME: this is required for now as it introduces a build failure -->
                <arg>-Xlint:-requires-transitive-automatic</arg> <!-- FIXME: this is required for now as it introduces a build failure -->
              </compilerArgs>
            </configuration>
            <executions>
              <!-- compile first with module-info for Java 9+ -->
              <execution>
                <id>default-compile</id>
                <configuration>
                  <release>11</release>
                </configuration>
              </execution>
              <!-- then compile without module-info for Java 8 -->
              <execution>
                <id>base-compile</id>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <release>8</release>
                  <excludes>
                    <exclude>module-info.java</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <!-- Surefire plugin is broken, https://issues.apache.org/jira/browse/SUREFIRE-1501 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.5.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-surefire-plugin;external_dependency} -->
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
