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

    <groupId>org.mule.tooling.tools</groupId>
    <artifactId>tooling-runtimes-maven-plugins</artifactId>
    <version>2.2.0</version>
    <packaging>maven-plugin</packaging>

    <name>tooling-runtimes-maven-plugins</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>11</java.version>

        <!-- Dependencies version -->
        <maven-plugin-annotations.version>3.15.1</maven-plugin-annotations.version>
        <maven-plugin-api.version>3.9.9</maven-plugin-api.version>
        <mule-tooling-bootstrap.version>1.8.10</mule-tooling-bootstrap.version>

        <!-- Plugins version -->
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-plugin-plugin.version>3.15.1</maven-plugin-plugin.version>
        <formatter-maven-plugin.version>2.23.0</formatter-maven-plugin.version>
        <build-tools.version>2.0.1</build-tools.version>

        <!-- Formatter config -->
        <skipVerifications>false</skipVerifications>
        <formatterGoal>validate</formatterGoal>
        <formatterConfigPath>eclipse/formatter.xml</formatterConfigPath>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <release>${java.version}</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven-plugin-plugin.version}</version>
                <configuration>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                    <goalPrefix>tooling-runtimes-tools</goalPrefix>
                </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>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <configuration>
                    <compilerCompliance>${java.version}</compilerCompliance>
                    <compilerSource>${java.version}</compilerSource>
                    <compilerTargetPlatform>${java.version}</compilerTargetPlatform>
                    <configFile>${formatterConfigPath}</configFile>
                    <configJsFile>${formatterConfigPath}</configJsFile>
                    <skipXmlFormatting>true</skipXmlFormatting>
                    <skipHtmlFormatting>true</skipHtmlFormatting>
                    <!-- Use line endings of current system -->
                    <lineEnding>AUTO</lineEnding>
                    <directories>
                        <directory>src</directory>
                    </directories>
                    <excludes>
                        <exclude>test/example/target/</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>apply-format</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>${formatterGoal}</goal>
                        </goals>
                        <configuration>
                            <skipFormatting>${skipVerifications}</skipFormatting>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${formatter-maven-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.mule.tooling</groupId>
                            <artifactId>build-tools</artifactId>
                            <version>${build-tools.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <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>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven-plugin-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tooling</groupId>
            <artifactId>mule-tooling-bootstrap</artifactId>
            <version>${mule-tooling-bootstrap.version}</version>
        </dependency>
        <!-- MuleRuntimeFeature uses JavaVersion.JAVA_21; force commons-lang3 with JAVA_21 (NoSuchFieldError fix for JDK 21) -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.20.0</version>
        </dependency>
    </dependencies>

    <distributionManagement>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Repository</name>
            <url>https://repository-master.mulesoft.org/releases</url>
        </repository>
        <snapshotRepository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshot Repository</name>
            <url>https://repository-master.mulesoft.org/snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <pluginRepositories>
        <pluginRepository>
            <id>mule-ee-releases</id>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>mule-ee-snapshots</id>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
        <pluginRepository>
            <id>mule-releases</id>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>mule-snapshots</id>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <repositories>
        <repository>
            <id>mulesoft-releases</id>
            <name>Nexus Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>mule-ee-releases</id>
            <name>MuleEE Releases Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>mulesoft-snapshots</id>
            <name>Nexus Snapshots Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

</project>
