<!-- Copyright (c) Microsoft Corporation. All rights reserved.
     Licensed under the MIT 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.azure</groupId>
  <artifactId>azure-data-sdk-parent</artifactId>
  <packaging>pom</packaging>
  <version>1.3.0</version> <!-- {x-version-update;com.azure:azure-data-sdk-parent;current} -->

  <name>Microsoft Azure SDK for Java - Data Plane Libraries</name>
  <description>Parent POM for Microsoft Azure SDK for Java</description>
  <url>https://github.com/Azure/azure-sdk-for-java</url>
  <organization>
    <name>Microsoft Corporation</name>
    <url>http://microsoft.com</url>
  </organization>

  <parent>
    <groupId>com.azure</groupId>
    <artifactId>azure-sdk-parent</artifactId>
    <version>1.6.0</version> <!-- {x-version-update;com.azure:azure-sdk-parent;current} -->
    <relativePath>./parent/pom.xml</relativePath>
  </parent>

  <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>

  <issueManagement>
    <system>GitHub</system>
    <url>${issues.url}</url>
  </issueManagement>

  <scm>
    <url>https://github.com/Azure/azure-sdk-for-java</url>
    <connection>scm:git:https://github.com/Azure/azure-sdk-for-java.git</connection>
    <developerConnection></developerConnection>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <packageOutputDirectory>${project.build.directory}</packageOutputDirectory>
    <legal>
      <![CDATA[[INFO] Any downloads listed may be third party software.  Microsoft grants you no rights for third party software.]]></legal>
    <testMode>playback</testMode>
    <playbackServerPort>11080</playbackServerPort>
    <alternativePlaybackServerPort>11081</alternativePlaybackServerPort>

    <site.url>https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java</site.url>
    <issues.url>https://github.com/Azure/azure-sdk-for-java/issues</issues.url>
    <build.context>azure-data-sdk-parent</build.context>
  </properties>

  <build>
    <plugins>
      <!-- This plugin scans checkstyle issues in these code -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.1.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-checkstyle-plugin;external_dependency} -->
        <dependencies>
          <dependency>
            <groupId>com.azure</groupId>
            <artifactId>sdk-build-tools</artifactId>
            <version>1.0.0</version> <!-- {x-version-update;com.azure:sdk-build-tools;external_dependency} -->
          </dependency>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>8.24</version> <!-- {x-version-update;com.puppycrawl.tools:checkstyle;external_dependency} -->
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>checkstyle/checkstyle.xml</configLocation>
          <suppressionsLocation>checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
          <headerLocation>checkstyle/java.header</headerLocation>
          <propertyExpansion>samedir=</propertyExpansion>
          <encoding>UTF-8</encoding>
          <consoleOutput>true</consoleOutput>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <linkXRef>true</linkXRef>

          <!-- TODO soon - enable these failure modes -->
          <failsOnError>false</failsOnError>
          <failOnViolation>false</failOnViolation>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- This plugin scans reports spotbugs in the code -->
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>3.1.12.2</version> <!-- {x-version-update;com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
        <dependencies>
          <dependency>
            <groupId>com.azure</groupId>
            <artifactId>sdk-build-tools</artifactId>
            <version>1.0.0</version> <!-- {x-version-update;com.azure:sdk-build-tools;external_dependency} -->
          </dependency>
        </dependencies>
        <configuration>
          <effort>Max</effort>
          <threshold>Low</threshold>
          <xmlOutput>true</xmlOutput>
          <spotbugsXmlOutputDirectory>${project.build.directory}/spotbugs</spotbugsXmlOutputDirectory>
          <excludeFilterFile>spotbugs/spotbugs-exclude.xml</excludeFilterFile>

          <!-- TODO soon - enable this failure mode -->
          <failOnError>false</failOnError>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- This plugin exports spotbugs reports in html form -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <version>1.0</version> <!-- {x-version-update;org.codehaus.mojo:xml-maven-plugin;external_dependency} -->
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>transform</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <transformationSets>
            <transformationSet>
              <dir>${project.build.directory}/spotbugs</dir>
              <includes><include>spotbugsXml.xml</include></includes>
              <outputDir>${project.build.directory}/spotbugs</outputDir>
              <stylesheet>fancy-hist.xsl</stylesheet>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                  <targetExtension>.html</targetExtension>
                </fileMapper>
              </fileMappers>
            </transformationSet>
          </transformationSets>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs</artifactId>
            <version>4.0.0-beta3</version> <!-- {x-version-update;com.github.spotbugs:spotbugs;external_dependency} -->
          </dependency>
        </dependencies>
      </plugin>

      <!-- Configure the jar plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.1.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-jar-plugin;external_dependency} -->
        <configuration>
          <outputDirectory>${packageOutputDirectory}</outputDirectory>
        </configuration>
      </plugin>

      <!-- Configure the javadoc plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.1.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>
            <configuration>
              <jarOutputDirectory>${packageOutputDirectory}</jarOutputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Configure the source plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.0.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>

      <!-- Copy the pom file to output -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version> <!-- {x-version-update;org.apache.maven.plugins:maven-antrun-plugin;external_dependency} -->
        <executions>
          <execution>
            <id>copy</id>
            <phase>package</phase>
            <configuration>
              <target>
                <copy file="${project.pomFile}" tofile="${packageOutputDirectory}/${project.build.finalName}.pom"/>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Allows the sample sources to be built during test-compile phase. -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version> <!-- {x-version-update;org.codehaus.mojo:build-helper-maven-plugin;external_dependency} -->
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
          <configuration>
            <source>8</source>
            <doctitle>Azure SDK for Java Reference Documentation</doctitle>
            <windowtitle>Azure SDK for Java Reference Documentation</windowtitle>
            <failOnError>false</failOnError>
            <footer>Visit the &lt;a href="https://docs.microsoft.com/java/azure/"&gt;Azure for Java Developers&lt;/a&gt;site for more Java documentation, including quick starts, tutorials, and code samples.</footer>
            <linksource>false</linksource>
            <excludePackageNames>com.microsoft.azure.template:*.impl.*:*.implementation.*</excludePackageNames>
            <groups>
              <group>
                <title>Azure Application Insights</title>
                <packages>com.microsoft.azure.applicationinsights*</packages>
              </group>
              <group>
                <title>Azure Batch</title>
                <packages>com.microsoft.azure.batch*</packages>
              </group>
              <group>
                <title>Azure Event Hubs</title>
                <packages>com.microsoft.azure.eventhubs*:com.microsoft.azure.eventprocessorhost</packages>
              </group>
              <group>
                <title>Azure Key Vault</title>
                <packages>com.microsoft.azure.keyvault*</packages>
              </group>
              <group>
                <title>Azure Service Bus</title>
                <packages>com.microsoft.azure.servicebus*</packages>
              </group>
              <group>
                <title>Azure Storage</title>
                <packages>com.microsoft.azure.storage*</packages>
              </group>
            </groups>
            <links>
              <link>https://docs.oracle.com/javase/8/docs/api/</link>
              <link>https://projectreactor.io/docs/core/release/api/</link>
              <link>https://netty.io/4.1/api/</link>
              <link>http://reactivex.io/RxJava/javadoc/</link>
            </links>
            <isOffline>false</isOffline>
          </configuration>
        </plugin>

        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>3.1.12.2</version> <!-- {x-version-update;com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
          <dependencies>
            <dependency>
              <groupId>com.azure</groupId>
              <artifactId>sdk-build-tools</artifactId>
              <version>1.0.0</version> <!-- {x-version-update;com.azure:sdk-build-tools;external_dependency} -->
            </dependency>
          </dependencies>
          <configuration>
            <effort>Max</effort>
            <threshold>Low</threshold>
            <xmlOutput>true</xmlOutput>
            <spotbugsXmlOutputDirectory>${project.build.directory}/spotbugs</spotbugsXmlOutputDirectory>
            <excludeFilterFile>spotbugs/spotbugs-exclude.xml</excludeFilterFile>

            <!-- TODO soon - enable this failure mode -->
            <failOnError>false</failOnError>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>3.0.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-jxr-plugin;external_dependency} -->
        <reportSets>
          <reportSet>
            <id>aggregate</id>
            <inherited>false</inherited>
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.1.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-checkstyle-plugin;external_dependency} -->
        <configuration>
          <configLocation>checkstyle/checkstyle.xml</configLocation>
          <suppressionsLocation>checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
          <headerLocation>checkstyle/java.header</headerLocation>
          <propertyExpansion>samedir=</propertyExpansion>
          <encoding>UTF-8</encoding>
          <consoleOutput>true</consoleOutput>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <linkXRef>true</linkXRef>

          <!-- TODO soon - enable these failure modes -->
          <failsOnError>false</failsOnError>
          <failOnViolation>false</failOnViolation>
        </configuration>
        <reportSets>
          <reportSet>
            <id>non-aggregate</id>
            <reports>
              <report>checkstyle</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>aggregate</id>
            <inherited>false</inherited>
            <reports>
              <report>checkstyle-aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>3.1.12.2</version> <!-- {x-version-update;com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
        <reportSets>
          <reportSet>
            <id>non-aggregate</id>
            <reports>
              <report>spotbugs</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>aggregate</id>
            <inherited>false</inherited>
            <reports>
              <report>spotbugs</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
        <reportSets>
          <reportSet>
            <id>non-aggregate</id>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>aggregate</id>
            <inherited>false</inherited>
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.0.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-project-info-reports-plugin;external_dependency} -->
        <reportSets>
          <reportSet>
            <reports>
              <report>index</report>
              <report>summary</report>
              <report>dependency-info</report>
              <report>dependency-management</report>
              <report>dependency-convergence</report>
              <report>ci-management</report>
              <report>dependencies</report>
              <report>issue-management</report>
              <report>licenses</report>
              <report>scm</report>
              <report>plugins</report>
              <report>plugin-management</report>
              <report>team</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>

    <!--
     By default we build against our baseline, Java 8, but we also want to ensure compatibility
     against the latest Java LTS release, currently Java 11. We therefore have two profiles:
       * The default 'java8', which will perform a build using Java 8 as its target.
       * The non-default 'java-lts' profile, which will build against the current LTS release.
   -->
    <profile>
      <id>java8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <property>
          <name>!java-lts</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <showWarnings>true</showWarnings>
              <showDeprecation>true</showDeprecation>
              <compilerArgument>-Xlint:all</compilerArgument>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-lts</id>
      <activation>
        <property>
          <name>java-lts</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
            <configuration>
              <source>11</source>
              <target>11</target>
              <showWarnings>true</showWarnings>
              <showDeprecation>true</showDeprecation>
              <compilerArgument>-Xlint:all</compilerArgument>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Customise the javadoc plugin to not include module directories in links. We don't
         currently use modules, so search results were being directed to an 'undefined'
         directory (for an 'undefined' module). This no-module-directories flag fixes
         this, but it is only required for JDK 9+ -->
    <profile>
      <id>javadoc-no-modules-fix</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
            <configuration>
              <additionalJOption>--no-module-directories</additionalJOption>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>non-shipping-modules</id>
      <activation>
        <property>
          <name>include-non-shipping-modules</name>
        </property>
      </activation>
      <modules>
        <module>./eng/spotbugs-aggregate-report</module>
        <module>./eng/code-quality-reports</module>
      </modules>
    </profile>

    <profile>
      <id>template-module</id>
      <activation>
        <property>
          <name>include-template</name>
        </property>
      </activation>
      <modules>
        <module>./sdk/template/azure-sdk-template</module>
      </modules>
    </profile>

    <!-- Skip overview generation unless -Dgenerate-overview is passed as an argument.
         This is specifically done to prevent requiring python as a pre-requisite since
         this is only needed by the build system. -->
    <profile>
      <id>generate-overview-from-readme</id>
      <activation>
        <property>
          <name>generate-overview</name>
        </property>      
      </activation>      
      <build>
        <plugins>  
          <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
              <executions>
                  <execution>
                      <id>generate-overview-from-readme</id>
                      <phase>prepare-package</phase>
                      <goals>
                          <goal>exec</goal>
                      </goals>
                  </execution>
              </executions>
              <configuration>
                <executable>python</executable>
                <workingDirectory>${project.basedir}</workingDirectory>
                <arguments>
                      <argument>../../../eng/pipelines/scripts/generate_overview_from_readme.py</argument>
                      <argument>--rf</argument>
                      <argument>${project.basedir}/README.md</argument>
                      <argument>--v</argument>
                      <argument>${project.version}</argument>
                </arguments>    
              </configuration>
          </plugin>
          <!-- Add the overview argument to the javadoc args -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
            <configuration combine.children="append">
              <overview>${project.basedir}/readme_overview.html</overview>
            </configuration>
          </plugin>
         </plugins>
      </build>
    </profile> 
  </profiles>

  <modules>
    <module>./sdk/batch/microsoft-azure-batch</module>
    <module>./sdk/applicationinsights/microsoft-azure-applicationinsights-query</module>
    <module>./sdk/cosmos</module>
    <module>./sdk/eventhubs/microsoft-azure-eventhubs/pom.xml</module>
    <module>./sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml</module>
    <module>./sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault-core/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault-test/pom.xml</module>
    <module>./sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml</module>
    <module>./sdk/servicebus/microsoft-azure-servicebus</module>
    <module>./sdk/storage/microsoft-azure-storage-blob</module>
  </modules>
</project>
