<?xml version="1.0" encoding="UTF-8"?>
<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.mule.extensions</groupId>
    <artifactId>mule-modules-parent</artifactId>
    <version>1.3.0</version>
  </parent>
  <groupId>com.avioconsulting.mule</groupId>
  <artifactId>avio-mule-modules-parent</artifactId>
  <!-- Version is in minor.major.patch.build format where major.minor.patch matches
        with upstream org.mule.extensions:mule-modules-parent version.
        The build is incremented for any changes to this parent within upstream version.
      -->
  <version>1.3.0.2</version>
  <packaging>pom</packaging>

  <name>com.avioconsulting.mule:avio-mule-modules-parent</name>
  <description>Parent POM for AVIO's Mule Modules</description>
  <url>https://github.com/avioconsulting/${project.artifactId}</url>

  <organization>
    <name>AVIO Consulting</name>
    <url>https://www.avioconsulting.com</url>
  </organization>

  <licenses>
    <license>
      <name>BSD-2-Clause</name>
      <url>https://opensource.org/licenses/BSD-2-Clause</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Adam DesJardin</name>
      <email>adesjardin@avioconsulting.com</email>
      <organization>AVIO Consulting</organization>
      <organizationUrl>https://www.avioconsulting.com</organizationUrl>
    </developer>
    <developer>
      <name>Manik Magar</name>
      <email>mmagar@avioconsulting.com</email>
      <organization>AVIO Consulting</organization>
      <organizationUrl>https://www.avioconsulting.com</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:${repository.url}</connection>
    <developerConnection>scm:ssh:${repository.url}</developerConnection>
    <url>${repository.url}</url>
  </scm>

  <issueManagement>
    <system>github.com</system>
    <url>https://github.com/${project.github.repository}/issues</url>
  </issueManagement>

  <properties>
    <project.github.repository>avioconsulting/${project.artifactId}</project.github.repository>
    <repository.url>git@github.com:${project.github.repository}.git</repository.url>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <nexus.url>https://oss.sonatype.org</nexus.url>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <mule.maven.plugin.version>3.2.7</mule.maven.plugin.version>
    <build.plugins.plugin.version>2.3.2</build.plugins.plugin.version>
    <maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version>
    <munit.extensions.maven.plugin.version>1.1.2</munit.extensions.maven.plugin.version>
    <munit.version>2.3.8</munit.version>
    <assertj-core.version>3.24.2</assertj-core.version>
    <JUnitParams.version>1.1.1</JUnitParams.version>
    <wiremock-jre8.version>2.35.1</wiremock-jre8.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <!-- Unit Testing Dependencies -->
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj-core.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>pl.pragmatists</groupId>
        <artifactId>JUnitParams</artifactId>
        <version>${JUnitParams.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.github.tomakehurst</groupId>
        <artifactId>wiremock-jre8</artifactId>
        <version>${wiremock-jre8.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>anypoint-exchange</id>
      <name>Anypoint Exchange</name>
      <url>https://maven.anypoint.mulesoft.com/api/v1/maven</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>mulesoft-releases</id>
      <name>MuleSoft Releases Repository</name>
      <url>https://repository.mulesoft.org/releases/</url>
      <layout>default</layout>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>mulesoft-releases</id>
      <name>mulesoft release repository</name>
      <url>https://repository.mulesoft.org/releases/</url>
      <layout>default</layout>
    </pluginRepository>
    <pluginRepository>
      <!-- Needed when using Munit extensions plugin -->
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>mulesoft-ee-releases</id>
      <name>mulesoft-ee-releases</name>
      <url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
      <layout>default</layout>
    </pluginRepository>
    <pluginRepository>
      <id>mulesoft-plugin-releases</id>
      <name>MuleSoft Release Repository</name>
      <url>https://repository.mulesoft.org/releases/</url>
      <layout>default</layout>
    </pluginRepository>
    <pluginRepository>
      <id>mulesoft-plugin-snapshots</id>
      <name>MuleSoft Snapshots Repository</name>
      <url>https://repository.mulesoft.org/snapshots/</url>
      <layout>default</layout>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>2.28.0</version>
          <configuration>
            <formats>
              <!-- you can define as many formats as you want, each is independent -->
              <format>
                <!-- define the files to apply to -->
                <includes>
                  <include>*.adoc</include>
                  <include>*.md</include>
                  <include>.gitignore</include>
                  <include>.xml</include>
                </includes>
                <!-- define the steps to apply to those files -->
                <trimTrailingWhitespace></trimTrailingWhitespace>
                <endWithNewline></endWithNewline>
                <indent>
                  <spaces>true</spaces>
                  <spacesPerTab>2</spacesPerTab>
                </indent>
              </format>
            </formats>
            <!-- define a language-specific format -->
            <java>
              <eclipse>
                <version>4.13.0</version>
                <file>${project.basedir}/eclipse-formatter.xml</file>
              </eclipse>
              <indent>
                <spaces>true</spaces>
                <spacesPerTab>2</spacesPerTab>
              </indent>
            </java>
            <pom>
              <sortPom></sortPom>
            </pom>
          </configuration>
          <executions>
            <execution>
              <id>checkSpotless</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>compile</phase>
            </execution>
            <execution>
              <id>applySpotless</id>
              <goals>
                <goal>apply</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.13</version>
        </plugin>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>2.2.2</version>
          <executions>
            <execution>
              <id>asciidoc-to-html</id>
              <goals>
                <goal>process-asciidoc</goal>
              </goals>
              <phase>generate-resources</phase>
              <configuration>
                <outputDirectory>${project.build.directory}/docs</outputDirectory>
                <attributes>
                  <revnumber>${project.version}</revnumber>
                  <revdate>${maven.build.timestamp}</revdate>
                  <source-highlighter>coderay</source-highlighter>
                  <coderay-css>style</coderay-css>
                </attributes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.bsc.maven</groupId>
          <artifactId>maven-processor-plugin</artifactId>
          <version>3.3.3</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.3.0</version>
          <executions>
            <execution>
              <id>parse-version</id>
              <goals>
                <!--Exposes `parsedVersion.*` properties used by copy plugin task-->
                <goal>parse-version</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <executions>
            <execution>
              <id>copy-module-version-resources</id>
              <goals>
                <goal>copy-resources</goal>
              </goals>
              <phase>process-resources</phase>
              <configuration>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <resources>
                  <resource>
                    <directory>src/main/resources-filtered</directory>
                    <filtering>true</filtering>
                  </resource>
                </resources>
              </configuration>
            </execution>
            <execution>
              <id>copy-resource-docs</id>
              <goals>
                <goal>resources</goal>
              </goals>
              <phase>generate-sources</phase>
              <configuration>
                <outputDirectory>${project.basedir}/docs/${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.x</outputDirectory>
                <resources>
                  <resource>
                    <directory>${project.build.directory}/docs</directory>
                    <includes>
                      <include>*.adoc</include>
                      <include>*.html</include>
                    </includes>
                  </resource>
                </resources>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.10</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>1.5.0</version>
          <configuration>
            <!-- Retain the configurations needed for publishing to OSSRH/Maven Central -->
            <flattenMode>ossrh</flattenMode>
          </configuration>
          <executions>
            <!-- enable flattening -->
            <execution>
              <id>flatten</id>
              <goals>
                <goal>flatten</goal>
              </goals>
              <phase>process-resources</phase>
            </execution>
            <!-- ensure proper cleanup -->
            <execution>
              <id>flatten.clean</id>
              <goals>
                <goal>clean</goal>
              </goals>
              <phase>clean</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>com.mulesoft.munit</groupId>
          <artifactId>munit-extensions-maven-plugin</artifactId>
          <version>${munit.extensions.maven.plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.10</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <!-- attached to Maven test phase -->
          <execution>
            <id>report</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>test</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <destDir>${project.build.directory}/docs/apidocs</destDir>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>com.mulesoft.munit</groupId>
        <artifactId>munit-extensions-maven-plugin</artifactId>
        <version>${munit.extensions.maven.plugin.version}</version>
        <configuration>
          <systemPropertyVariables>

          </systemPropertyVariables>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${munit.version}</version>
            <classifier>mule-plugin</classifier>
          </dependency>
          <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-tools</artifactId>
            <version>${munit.version}</version>
            <classifier>mule-plugin</classifier>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <goals>
              <goal>test</goal>
            </goals>
            <phase>integration-test</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>maven-publish</id>
      <activation>
        <property>
          <name>release</name>
          <value>true</value>
        </property>
      </activation>

      <distributionManagement>
        <repository>
          <id>ossrh</id>
          <url>${nexus.url}/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
          <id>ossrh</id>
          <url>${nexus.url}/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${maven.enforcer.plugin.version}</version>
            <executions>
              <execution>
                <id>enforce-no-snapshots-in-deps</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireReleaseDeps>
                      <message>No Snapshots Allowed in Deps!</message>
                    </requireReleaseDeps>
                    <requirePluginVersions>
                      <message>Best Practice is to always define plugin versions!</message>
                      <unCheckedPluginList>org.apache.maven.plugins:maven-source-plugin,
                        org.apache.maven.plugins:maven-resources-plugin,
                        org.apache.maven.plugins:maven-surefire-plugin,
                        org.apache.maven.plugins:maven-clean-plugin,
                        org.apache.maven.plugins:maven-install-plugin,
                        org.apache.maven.plugins:maven-deploy-plugin</unCheckedPluginList>
                    </requirePluginVersions>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <destDir>${project.build.directory}/docs/apidocs</destDir>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>${nexus.url}</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>gpg-sign</id>
      <activation>
        <property>
          <name>release</name>
          <value>true</value>
        </property>
      </activation>
      <properties>
        <gpg.executable>gpg</gpg.executable>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <configuration>
              <!-- Prevent gpg from using pinentry programs -->
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>parent-pom</id>
      <activation>
        <file>
          <exists>.parent.pom.build.txt</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>flatten-maven-plugin</artifactId>
            <configuration>
              <!-- The minimal flattening for parent pom -->
              <flattenMode>resolveCiFriendliesOnly</flattenMode>
              <pomElements>
                <name></name>
                <url></url>
                <scm></scm>
              </pomElements>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
