<?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.agent</groupId>
    <artifactId>ubp-plugin</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>pom</packaging>

    <modules>
        <module>ubp-common</module>
        <module>ubp-runtime-agent-plugin</module>
    </modules>

    <properties>
        <formatterGoal>validate</formatterGoal>
        <formatterConfigPath>../formatter.xml</formatterConfigPath>
        <javaFormatter.plugin.version>2.14.0</javaFormatter.plugin.version>
        <javaReleaseVersion>8</javaReleaseVersion>
        <javaVersion>8</javaVersion>
        <license.maven.plugin.version>4.2</license.maven.plugin.version>
        <licensePath>LICENSE_HEADER_CPAL.txt</licensePath>
        <licenseYear>2024</licenseYear>
        <mavenCompilerVersion>3.11.0</mavenCompilerVersion>
        <mulesoftLicenseVersion>1.4.0</mulesoftLicenseVersion>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipCodeFormatting>false</skipCodeFormatting>
    </properties>

    <build>
        <defaultGoal>install</defaultGoal>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${javaFormatter.plugin.version}</version>
                    <configuration>
                        <compilerCompliance>${javaVersion}</compilerCompliance>
                        <compilerSource>${javaVersion}</compilerSource>
                        <compilerTargetPlatform>${javaVersion}</compilerTargetPlatform>
                        <configFile>${basedir}/${formatterConfigPath}</configFile>
                        <configJsFile>${basedir}/${formatterConfigPath}</configJsFile>
                        <aggregator>false</aggregator>
                        <executionRoot>true</executionRoot>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>${formatterGoal}</goal>
                            </goals>
                            <configuration>
                                <skipFormatting>${skipCodeFormatting}</skipFormatting>
                            </configuration>
                        </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>process-sources</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${mavenCompilerVersion}</version>
                    <configuration>
                        <source>${javaVersion}</source>
                        <target>${javaVersion}</target>
                        <testSource>${javaVersion}</testSource>
                        <testTarget>${javaVersion}</testTarget>
                        <parameters>true</parameters>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
        </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <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>
</project>