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

  <groupId>com.mulesoft.anypoint</groupId>
  <artifactId>pdk-maven-plugin</artifactId>
  <version>1.0.0</version>
  <packaging>maven-plugin</packaging>

  <name>pdk-maven-plugin Maven Plugin</name>

  <prerequisites>
    <maven>${maven.version}</maven>
  </prerequisites>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>8</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <maven.version>3.3.9</maven.version>

    <jackson.version>2.18.1</jackson.version>

    <maven.plugin.annotations.version>3.13.1</maven.plugin.annotations.version>
    <junit.version>4.12</junit.version>
    <maven.plugin.testing.harness.version>3.3.0</maven.plugin.testing.harness.version>
    <maven.surefire.plugin.version>3.3.0</maven.surefire.plugin.version>
    <maven.plugin.plugin.version>3.15.1</maven.plugin.plugin.version>

    <license.maven.plugin.version>4.5</license.maven.plugin.version>
    <mulesoftLicenseVersion>1.1.0</mulesoftLicenseVersion>
    <license.maven.plugin.version>4.2</license.maven.plugin.version>
    <licensePath>LICENSE_HEADER.txt</licensePath>
    <licenseYear>2024</licenseYear>
    <javaFormatter.plugin.version>2.14.0</javaFormatter.plugin.version>
    <formatterConfigPath>formatter.xml</formatterConfigPath>
    <formatterGoal>validate</formatterGoal>
    <allureJunitVersion>2.22.2</allureJunitVersion>
    <allureReportVersion>2.8.1</allureReportVersion>
    <allure.maven.plugin.version>2.12.0</allure.maven.plugin.version>
    <jacoco.version>0.8.11</jacoco.version>
    <aspectjVersion>1.9.2</aspectjVersion>
    <surefire.additional.jacoco.args></surefire.additional.jacoco.args>
    <surefire.args.base>
      -XX:+TieredCompilation
      -Dfile.encoding=UTF-8
      -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar
      -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile='${session.executionRootDirectory}/target/jacoco.exec'${surefire.additional.jacoco.args}
    </surefire.args.base>
    <surefire.args>${surefire.args.base}</surefire.args>
    <argLine/> <!-- empty argLine, needed by surefire for when @{argLine} is not set -->
    <skipVerifications>false</skipVerifications>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>${maven.plugin.annotations.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-compat</artifactId>
      <version>${maven.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-testing</groupId>
      <artifactId>maven-plugin-testing-harness</artifactId>
      <version>${maven.plugin.testing.harness.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.qameta.allure</groupId>
      <artifactId>allure-junit4</artifactId>
      <version>${allureJunitVersion}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>${maven.plugin.plugin.version}</version>
        <configuration>
          <!-- <goalPrefix>maven-archetype-plugin</goalPrefix> -->
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
          <execution>
            <id>help-goal</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>${license.maven.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.mulesoft.license</groupId>
            <artifactId>license</artifactId>
            <version>${mulesoftLicenseVersion}</version>
          </dependency>
        </dependencies>
        <configuration>
          <header>${licensePath}</header>
          <properties>
            <year>${licenseYear}</year>
          </properties>
          <includes>
            <include>**/*.java</include>
          </includes>
          <mapping>
            <java>SLASHSTAR_STYLE</java>
          </mapping>
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
        <version>${javaFormatter.plugin.version}</version>
        <configuration>
          <compilerCompliance>${java.version}</compilerCompliance>
          <compilerSource>${java.version}</compilerSource>
          <compilerTargetPlatform>${java.version}</compilerTargetPlatform>
          <configFile>${basedir}/${formatterConfigPath}</configFile>
          <configJsFile>${basedir}/${formatterConfigPath}</configJsFile>
          <aggregator>false</aggregator>
          <executionRoot>true</executionRoot>
          <encoding>ISO-8859-1</encoding>
        </configuration>
        <executions>
          <execution>
            <id>apply-format</id>
            <phase>compile</phase>
            <goals>
              <goal>${formatterGoal}</goal>
            </goals>
            <configuration>
              <skipFormatting>${skipVerifications}</skipFormatting>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.plugin.version}</version>
        <dependencies>
          <!--Setting this surefire dependency forces all tests to run ONLY with JUnit.-->
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit47</artifactId>
            <version>${maven.surefire.plugin.version}</version>
          </dependency>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectjVersion}</version>
          </dependency>
          <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.agent</artifactId>
            <version>${jacoco.version}</version>
            <classifier>runtime</classifier>
          </dependency>
        </dependencies>
        <configuration>
          <argLine>@{argLine} -Dfile.encoding=UTF-8</argLine>
          <reuseForks>true</reuseForks>
          <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
          <workingDirectory>${project.build.directory}</workingDirectory>
          <argLine>${surefire.args}</argLine>
          <trimStackTrace>false</trimStackTrace>
          <excludes>
            <!-- Surefire should be able to detect that classes are abstract but it seems it isn't -->
            <exclude>**/Abstract*.*</exclude>
            <!-- Our tests never start with Test* but we have a lot of test helpers that match -->
            <exclude>**/Test*.java</exclude>
            <!-- exclude inner classes -->
            <exclude>**/*$*</exclude>
          </excludes>
          <properties>
            <property>
              <name>listener</name>
              <value>io.qameta.allure.junit4.AllureJunit4</value>
            </property>
          </properties>
          <systemPropertyVariables>
            <!-- Just propagate this variable due to surefire will not do this when forked vm for tests -->
            <mule.freePortFinder.lockPath>${java.io.tmpdir}/mule/freePortFinder</mule.freePortFinder.lockPath>
            <maven.projectVersion>${project.version}</maven.projectVersion>
          </systemPropertyVariables>
          <systemProperties>
            <property>
              <name>allure.results.directory</name>
              <value>${project.build.directory}/allure-results</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-maven</artifactId>
        <version>${allure.maven.plugin.version}</version>
        <configuration>
          <reportVersion>${allureReportVersion}</reportVersion>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <distributionManagement>
    <repository>
      <id>mule-releases</id>
      <name>Mule Release Repository</name>
      <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases</url>
    </repository>
    <snapshotRepository>
      <id>mule-snapshots</id>
      <name>Mule Snapshot Repository</name>
      <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots</url>
      <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
  </distributionManagement>

</project>
