<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.mule.runtime</groupId>
        <artifactId>mule-modules</artifactId>
        <version>4.1.0</version>
        <relativePath></relativePath>
    </parent>

    <groupId>org.mule.modules</groupId>
    <artifactId>mule-module-file-extension-common</artifactId>
    <name>Mule File Extension Common</name>
    <version>1.4.8</version>
    <packaging>mule-plugin</packaging>
    <description>
        Reusable components for extensions built using Mule's SDK which operate over file systems (e.g: file, ftp, sftp, etc)
    </description>
    <licenses>
        <license>
            <name>Salesforce Main Services Agreement</name>
            <url>https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Salesforce_MSA.pdf</url>
        </license>
    </licenses>

    <properties>
        <antVersion>1.10.11</antVersion>
        <mule.version>4.1.0</mule.version>
        <commons.io.version>2.18.0</commons.io.version>
        <commons.lang3.version>3.20.0</commons.lang3.version>
        <javax.activation.version>1.2.0</javax.activation.version>
        <formatterConfigPath>formatter.xml</formatterConfigPath>
        <maven.help.plugin.version>3.5.2</maven.help.plugin.version>
        <slf4j.version>2.0.17</slf4j.version>
        <jacoco.version>0.8.14</jacoco.version>

        <!-- MUnit min runtime: skip 4.1/4.2 (both EOL per MuleSoft support policy;
             log4j 2.25.3 CVE-fix is incompatible with their shipped log4j). -->
        <minVersion>4.3.0</minVersion>

        <!-- Remove when a new parent version with MTF is available -->
        <munit.extensions.maven.plugin.version>1.7.0</munit.extensions.maven.plugin.version>
        <munit.version>3.7.0</munit.version>
        <mtf.tools.version>1.2.0</mtf.tools.version>
        <munit.input.directory>src/test/munit</munit.input.directory>
        <munit.output.directory>${basedir}/target/test-mule/munit</munit.output.directory>
        <mavenResources.version>3.4.0</mavenResources.version>
        <file.connector.version>1.5.3</file.connector.version>
        <log4jVersion>2.25.3</log4jVersion>
        <license-enforcement-maven-plugin.version>2.7.1</license-enforcement-maven-plugin.version>
        <license.maven.plugin.version>4.6</license.maven.plugin.version>
        <licensePath>LICENSE_HEADER.txt</licensePath>
        <licenseYear>2026</licenseYear>
        <maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
        <skipCPALVerifications>false</skipCPALVerifications>
    </properties>

    <dependencies>
        <!-- Mule Dependencies -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
            <version>${javax.activation.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons.io.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons.lang3.version}</version>
        </dependency>

        <!--Test Dependencies-->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${mule.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests.plugin</groupId>
            <artifactId>mule-tests-component-plugin</artifactId>
            <version>${mule.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <License>Salesforce Main Services Agreement https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Salesforce_MSA.pdf</License>
                        </manifestEntries>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.mule.runtime.plugins</groupId>
                <artifactId>mule-plugin-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${mavenResources.version}</version>
                <executions>
                    <execution>
                        <id>copy-munit-resources</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${munit.output.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${munit.input.directory}</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-test-license-notice</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.testOutputDirectory}/META-INF</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}</directory>
                                    <includes>
                                        <include>LICENSE.txt</include>
                                    </includes>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-license-notice</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}</directory>
                                    <includes>
                                        <include>LICENSE.txt</include>
                                    </includes>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license-enforcement-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-banned-licenses</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>add-third-party</goal>
                        </goals>
                        <configuration>
                            <failOnBlacklist>true</failOnBlacklist>
                            <failOnMissing>true</failOnMissing>
                            <excludedLicenses>
                                <excludedLicense>CPAL</excludedLicense>
                                <excludedLicense>Common Public Attributions</excludedLicense>
                                <excludedLicense>Common Public Attribution License 1.0</excludedLicense>
                                <excludedLicense>CPAL v1.0</excludedLicense>
                                <excludedLicense>CPAL-1.0</excludedLicense>
                            </excludedLicenses>
                            <excludedScopes>provided,test,system</excludedScopes>
                            <skipAddThirdParty>${skipCPALVerifications}</skipAddThirdParty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>validate-license-checksums</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireTextFileChecksum>
                                    <file>${project.basedir}/LICENSE.txt</file>
                                    <checksum>9267999fa89cb9da4cbfaab8c19ea04f435b7add36c81cc4d3c5e99b45aec651</checksum>
                                    <type>sha256</type>
                                    <normalizeLineSeparatorTo>UNIX</normalizeLineSeparatorTo>
                                    <encoding>UTF-8</encoding>
                                    <message>The LICENSE.txt file has been modified and does not match the required text.</message>
                                    <nonexistentFileMessage>The LICENSE.txt file is missing from the repository root.</nonexistentFileMessage>
                                </requireTextFileChecksum>
                                <requireTextFileChecksum>
                                    <file>${project.basedir}/LICENSE_HEADER.txt</file>
                                    <checksum>d53c60030c6bb27590c509a1750b1bd3451548c7fb6644e8406861e06f35e6c2</checksum>
                                    <type>sha256</type>
                                    <normalizeLineSeparatorTo>UNIX</normalizeLineSeparatorTo>
                                    <encoding>UTF-8</encoding>
                                    <message>The LICENSE_HEADER.txt file has been modified and does not match the required text.</message>
                                    <nonexistentFileMessage>The LICENSE_HEADER.txt file is missing from the repository root.</nonexistentFileMessage>
                                </requireTextFileChecksum>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license.maven.plugin.version}</version>
                <configuration>
                    <header>${licensePath}</header>
                    <properties>
                        <year>${licenseYear}</year>
                    </properties>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <id>default</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <header>${licensePath}</header>
                            <properties>
                                <year>${licenseYear}</year>
                            </properties>
                            <includes>
                                <include>**/*.java</include>
                            </includes>
                            <mapping>
                                <java>SLASHSTAR_STYLE</java>
                            </mapping>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <destFile>${session.executionRootDirectory}/target/jacoco-java.exec</destFile>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>merge</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <destFile>${session.executionRootDirectory}/target/jacoco.exec</destFile>
                            <fileSets>
                                <fileSet>
                                    <directory>${session.executionRootDirectory}/target</directory>
                                    <includes>
                                        <include>*.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${session.executionRootDirectory}/target/jacoco.exec</dataFile>
                            <outputDirectory>${session.executionRootDirectory}/target/jacoco</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.mulesoft.munit</groupId>
                <artifactId>munit-extensions-maven-plugin</artifactId>
                <version>${munit.extensions.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>integration-test</phase>
                    </execution>
                </executions>
                <configuration>
                    <argLines>
                        <argLine>
                            -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${session.executionRootDirectory}/target/jacoco-munit.exec
                        </argLine>
                    </argLines>
                    <productConfiguration>
                        <!--
                          The <discoverProduct> below is a load-bearing no-op: minVersion=999.999.0
                          returns zero Nexus matches, so it contributes nothing to the runtime matrix.
                          Its sole job is to keep productsToDiscover non-empty inside
                          munit-extensions-maven-plugin (see AbstractMunitMojo#getRunConfigurations
                          and ExtensionTestMojo#shouldAddMuleFwkConfiguration), which suppresses two
                          auto-picks that would otherwise poison the matrix and NPE the plugin:
                            - MULE_CE:4.1.1 (default fallback — log4j 2.25.3 CVE fix breaks it)
                            - MULE_FWK:1.0.0-SNAPSHOT (parent pom not in SFCI nexus mirror)
                          The explicit pins in <additionalProducts> are what actually run.
                          4.5.x/4.7.x omitted: on JDK 8 those Mule versions load
                          annotations declaring newer enum constants that
                          mule-extensions-api 1.1.0 (shipped by mule-modules:4.1.0
                          parent) does not know about, causing an
                          ArrayStoreException:EnumConstantNotPresentExceptionProxy
                          at deploy time before test discovery.
                        -->
                        <discoverProducts>
                            <discoverProduct>
                                <id>MULE_EE</id>
                                <minVersion>999.999.0</minVersion>
                            </discoverProduct>
                        </discoverProducts>
                        <additionalProducts>
                            <additionalProduct>MULE_EE:4.3.0</additionalProduct>
                            <additionalProduct>MULE_EE:4.4.0</additionalProduct>
                            <additionalProduct>MULE_EE:4.6.32</additionalProduct>
                            <additionalProduct>MULE_EE:4.8.15</additionalProduct>
                        </additionalProducts>
                    </productConfiguration>
                </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>
                    <dependency>
                        <groupId>org.mule.connectors</groupId>
                        <artifactId>mule-file-connector</artifactId>
                        <version>${file.connector.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                    <dependency>
                        <groupId>com.mulesoft.munit</groupId>
                        <artifactId>mtf-tools</artifactId>
                        <version>${mtf.tools.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <properties>
                <skipGpg>false</skipGpg>
                <skipNoSnapshotsEnforcerPluginRule>false</skipNoSnapshotsEnforcerPluginRule>
            </properties>
            <build>
                <resources>
                    <resource>
                        <directory>${project.basedir}</directory>
                        <includes>
                            <include>LICENSE.txt</include>
                        </includes>
                        <filtering>false</filtering>
                    </resource>
                </resources>
                <testResources>
                    <testResource>
                        <directory>src/test/resources</directory>
                    </testResource>
                    <testResource>
                        <directory>${project.basedir}</directory>
                        <includes>
                            <include>LICENSE.txt</include>
                        </includes>
                        <filtering>false</filtering>
                    </testResource>
                </testResources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <skip>${skipGpg}</skip>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>package-javadoc-license-notice</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/apidocs</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.basedir}</directory>
                                            <includes>
                                                <include>LICENSE.txt</include>
                                            </includes>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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

    <repositories>
        <repository>
            <id>mule</id>
            <name>Mule Repository</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>mule-plugin</id>
            <name>Mule Repository</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
        </pluginRepository>
    </pluginRepositories>
</project>
