<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>com.mulesoft.mule.runtime</groupId>
        <artifactId>mule</artifactId>
        <version>4.11.0</version>
    </parent>

    <groupId>com.mulesoft.anypoint</groupId>
    <artifactId>api-gateway-parent</artifactId>
    <version>4.11.0</version>

    <packaging>pom</packaging>

    <!-- Organization -->
    <organization>
        <name>MuleSoft, Inc.</name>
        <url>http://www.mulesoft.com</url>
    </organization>

    <!-- Project -->
    <name>API Gateway Parent</name>
    <url>http://www.mulesoft.com</url>
    <inceptionYear>2014</inceptionYear>

    <licenses>
        <license>
            <name>MSA</name>
            <url>http://www.mulesoft.com/</url>
        </license>
    </licenses>

    <!-- Build -->
    <scm>
        <connection>scm:git:git://github.com/mulesoft/api-gateway.git</connection>
        <developerConnection>scm:git:git@github.com:mulesoft/api-gateway.git</developerConnection>
        <url>http://github.com/mulesoft/api-gateway</url>
    </scm>

    <properties>
        <currentYear>2020</currentYear>
        <apacheHttpClientVersion>4.5.13</apacheHttpClientVersion>
        <apiGatewayVersion>4.11.0</apiGatewayVersion>
        <apiGatewayApiVersion>1.11.0</apiGatewayApiVersion>
        <apiGatewayTitaVersion>4.15.0</apiGatewayTitaVersion>
        <contractsServiceVersion>1.7.0</contractsServiceVersion>
        <contractsServiceApiVersion>1.8.0</contractsServiceApiVersion>
        <apiGatewayEventsCollectors>1.7.0</apiGatewayEventsCollectors>
        <apiGatewayEventsCollectorsApi>1.6.0</apiGatewayEventsCollectorsApi>
        <muleVersion>4.11.0</muleVersion>
        <muleHttpConnectorVersion>1.11.0</muleHttpConnectorVersion>
        <muleSocketsConnectorVersion>1.1.1</muleSocketsConnectorVersion>
        <mule.maven.plugin.version>4.6.1</mule.maven.plugin.version>
        <httpclientVersion>${apacheHttpClientVersion}</httpclientVersion>
        <apacheHttpFluentVersion>${httpclientVersion}</apacheHttpFluentVersion>
        <jackson2Version>2.15.0</jackson2Version>
        <mapdbVersion>1.0.6</mapdbVersion>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.surefire.version>${maven.surefire.plugin.version}</maven.surefire.version>
        <slf4jTestVersion>2.6.1</slf4jTestVersion>

        <mulesoftLicenseVersion>1.1.0</mulesoftLicenseVersion>
        <license.maven.plugin.version>4.2</license.maven.plugin.version>
        <licensePath>LICENSE_HEADER_80.txt</licensePath>
        <licenseYear>2023</licenseYear>

        <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>
        <mule.termination.log.path.env.variable>${java.io.tmpdir}/termination_log_set_by_env_property</mule.termination.log.path.env.variable>
        <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 -->
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <!--
                    The bulk of the config of the jar plugin is inherited from the parent
                    POM. We need to override the license, however ...
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Description>API Gateway Platform</Description>
                                <License>MSA v1.0 http://www.mulesoft.com/</License>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                    <configuration>
                        <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>
                        <environmentVariables>
                            <MULE_TERMINATION_LOG_PATH>${mule.termination.log.path.env.variable}</MULE_TERMINATION_LOG_PATH>
                        </environmentVariables>
                    </configuration>
                    <dependencies>
                        <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>
                </plugin>
                <plugin>
                    <groupId>io.qameta.allure</groupId>
                    <artifactId>allure-maven</artifactId>
                    <version>${allure.maven.plugin.version}</version>
                    <configuration>
                        <reportVersion>${allureReportVersion}</reportVersion>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <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>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.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.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>@{argLine} ${surefire.args.base}</argLine>
                    <reuseForks>true</reuseForks>
                </configuration>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-webdav</artifactId>
                <version>1.0-beta-2</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <id>nexus-ee</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <distributionManagement>
                <repository>
                    <id>mule-ee-customer-releases</id>
                    <name>Mule Release Repository</name>
                    <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <skipNoSnapshotsEnforcerPluginRule>false</skipNoSnapshotsEnforcerPluginRule>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>1.4.1</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>
                                        <requireReleaseVersion>
                                            <message>No Snapshots Allowed in Project Version!</message>
                                        </requireReleaseVersion>
                                        <requirePluginVersions>
                                            <message>Best Practice is to always define plugin versions!</message>
                                            <unCheckedPluginList>
                                                org.mule.tools.maven:exchange-mule-maven-plugin,
                                                org.apache.maven.plugins:maven-clean-plugin
                                            </unCheckedPluginList>
                                        </requirePluginVersions>
                                    </rules>
                                    <skip>${skipNoSnapshotsEnforcerPluginRule}</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release-dry-run</id>
            <properties>
                <skipNoSnapshotsEnforcerPluginRule>false</skipNoSnapshotsEnforcerPluginRule>
            </properties>
            <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>
                                            <excludes>
                                                <exclude>org.mule.weave:*</exclude>
                                                <exclude>com.mulesoft.services:mule-service-weave-ee</exclude>
                                                <exclude>org.mule.runtime:mule-dwb-api</exclude>
                                                <exclude>org.mule.services:*</exclude>
                                                <exclude>org.mule.tools.maven:mule-classloader-model</exclude>

                                                <exclude>com.mulesoft.anypoint:api-gateway-tita-unit</exclude>
                                                <exclude>com.mulesoft.anypoint.tita:test-dependencies</exclude>
                                                <exclude>com.mulesoft.anypoint:api-gateway-tita-environment-api</exclude>
                                            </excludes>
                                        </requireReleaseDeps>
                                    </rules>
                                    <skip>${skipNoSnapshotsEnforcerPluginRule}</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <downloadUrl>http://www.mulesoft.com/mule-esb-enterprise-trial-download</downloadUrl>
        <repository>
            <id>mule-ee-releases</id>
            <name>Mule Release Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases</url>
        </repository>
        <snapshotRepository>
            <id>mule-ee-snapshots</id>
            <name>Mule Snapshot Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <pluginRepositories>
        <pluginRepository>
            <id>mule-ci-releases</id>
            <name>Internal Release Repo</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>mule-ci-snapshots</id>
            <name>MuleEE Snapshots Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <repositories>
        <!--
            This repository definition is redundant as it's already present in the
            parent pom.

            However, when building the Enterprise modules with an empty local repository
            for the first time, the build *has* to know where to get its parent from and
            there's no way around this repo definition.
        -->
        <repository>
            <id>mule-ee-releases</id>
            <name>Internal Release Repo</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/ci-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>mule-ee-snapshots</id>
            <name>Internal Release Repo</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/ci-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>libs-releases</id>
            <name>External libs</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/libs-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>https://repository.mulesoft.org/releases/</url>
        </repository>
        <repository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshots Repository</name>
            <url>https://repository.mulesoft.org/snapshots/</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${httpclientVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>${mockitoVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
                <version>${jacksonVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
                <version>${jacksonVersion}</version>
            </dependency>
            <dependency>
                <groupId>com.github.valfirst</groupId>
                <artifactId>slf4j-test</artifactId>
                <version>${slf4jTestVersion}</version>
            </dependency>
            <dependency>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-junit4</artifactId>
                <version>${allureJavaVersion}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>
