<?xml version="1.0" encoding="UTF-8"?>
<!--
  W-23230045 — Maven wrapper for the SFCI managed publish of anypoint-api-console.

  anypoint-api-console is an npm package (@mulesoft/api-console-build). APIKit and
  Studio consume it as a Maven artifact `org.mule.apikit:anypoint-api-console:tar.gz`
  on repository-master.mulesoft.org. The legacy Jenkinsfile-apikit re-published the
  npm tarball as that Maven tar.gz with a hand-rolled `mvn deploy-file`.

  SFCI Managed forbids a custom step from authenticating to MuleSoft Nexus (the
  MULESOFT_PUBLIC_NEXUS_*_RW credentials are injected ONLY by the managed
  `maven-publish` step when `mulesoft-nexus: true`; a `$$cred.*` reference in a
  user step fails schema validation, and a name-only declaration resolves empty ->
  HTTP 401). The managed step runs `mvn deploy`, which needs a Maven project — this
  pom is that project.

  Flow (see .strata.yml `publish` stage):
    1. download-console-tarball step: downloads the published npm .tgz for the
       target version into target/anypoint-api-console-<version>.tar.gz and pins
       this pom's version to it (mvn versions:set).
    2. managed maven-publish (mulesoft-nexus: true): `mvn deploy` attaches that
       tar.gz (build-helper below) and deploys it to `mule-releases` using the
       injected RW credentials via the SFCI-mounted settings.xml.
-->
<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>org.mule.apikit</groupId>
    <artifactId>anypoint-api-console</artifactId>
    <!-- Placeholder; the download step pins the real release version at build time
         via `mvn versions:set -DnewVersion=<deploy_tag>`. -->
    <version>6.6.300</version>
    <packaging>pom</packaging>

    <name>anypoint-api-console</name>
    <description>Maven distribution of the Anypoint API Console (built from @mulesoft/api-console-build)</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.install.skip>true</maven.install.skip>
    </properties>

    <distributionManagement>
        <!-- 'mule-releases' is defined in the SFCI-mounted settings.xml
             (sfci-managed-shared-library mulesoft-proxy-settings.xml / apikit-sfci
             settings.xml) with the MULESOFT_PUBLIC_NEXUS_*_RW credentials that the
             managed maven-publish step (mulesoft-nexus: true) injects. -->
        <repository>
            <id>mule-releases</id>
            <name>MuleSoft Nexus Releases</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases/</url>
        </repository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <!-- Attaches the pre-downloaded npm tarball as the deployable
                     `tar.gz` artifact (same coordinates the legacy Jenkins job used). -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>attach-console-tarball</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/${project.artifactId}-${project.version}.tar.gz</file>
                                    <type>tar.gz</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
