<?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.connectivity</groupId>
    <artifactId>interpreted-connectivity-link-weave</artifactId>
    <version>1.5.0-643.develop</version>
    <packaging>pom</packaging>
    <name>link-weave</name>

    <properties>
        <maven.compiler.release>17</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <pathToTop>.</pathToTop>
        <formatterConfigPath>${pathToTop}/formatter.xml</formatterConfigPath>
        <licensePath>${pathToTop}/LICENSE_HEADER.txt</licensePath>

        <!-- DataWeave -->
        <data.weave.version>2.10.1-20250926</data.weave.version>
        <data.weave.http.version>2.10.0</data.weave.http.version>

        <data.weave.http.module.version>${data.weave.http.version}</data.weave.http.module.version>
        <data.weave.http.netty.module.version>${data.weave.http.version}</data.weave.http.netty.module.version>
        <data.weave.maven.plugin.version>2.10.0</data.weave.maven.plugin.version>
        <data.weave.testing.framework.version>2.10.0</data.weave.testing.framework.version>

        <!-- Data Cloud (DC) specific versions -->
        <dc.data.weave.version>2.10.1-20250926</dc.data.weave.version>
        <dc.data.weave.http.version>2.10.0</dc.data.weave.http.version>
        <dc.data.weave.http.module.version>${dc.data.weave.http.version}</dc.data.weave.http.module.version>
        <dc.data.weave.http.netty.module.version>${dc.data.weave.http.version}</dc.data.weave.http.netty.module.version>
        <dc.data.weave.maven.plugin.version>2.10.0</dc.data.weave.maven.plugin.version>
        <dc.data.weave.testing.framework.version>2.10.0</dc.data.weave.testing.framework.version>

        <plexus.utils.version>4.0.2</plexus.utils.version>
        <lombok.version>1.18.42</lombok.version>
        <checkstyle.version>12.1.0</checkstyle.version>

        <skipVerifications>false</skipVerifications>
        <formatterGoal>validate</formatterGoal>
        <importGoal>check</importGoal>

        <!--Plugins-->
        <maven.checkstyle.plugin.version>3.6.0</maven.checkstyle.plugin.version>
        <maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
        <maven.impsort.plugin.version>1.12.0</maven.impsort.plugin.version>
        <maven.jar.plugin.version>3.4.2</maven.jar.plugin.version>
        <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
        <maven.shade.plugin.version>3.6.1</maven.shade.plugin.version>
        <maven.surefire.plugin.version>3.3.0</maven.surefire.plugin.version>
        <jacoco.maven.plugin.version>0.8.13</jacoco.maven.plugin.version>
        <javaFormatter.plugin.version>2.29.0</javaFormatter.plugin.version>

        <license.maven.plugin.version>4.1</license.maven.plugin.version>
        <mulesoftLicenseVersion>1.4.0</mulesoftLicenseVersion>
    </properties>

    <modules>
        <module>connectivity-content-document-service</module>
        <module>connectivity-content-document-service-impl</module>
        <module>connectivity-language</module>
        <module>connectivity-model-api</module>
        <module>connectivity-flow-language</module>
        <module>connectivity-flow-extension</module>
        <module>connectivity-flow-interpreter-tests</module>
        <module>connectivity-flow-maven-plugin</module>
        <module>ccm-codegen</module>
        <module>connectivity-dc-language</module>
        <module>connectivity-dc-maven-plugin</module>
        <module>connectivity-dc-extension</module>
        <module>connectivity-dc-adapter</module>
        <module>reference-connector</module>
        <module>connectivity-maven-plugin</module>
        <module>connectivity-tooling-support</module>
        <module>connectivity-fix-engine</module>
        <module>connectivity-flow-revapi</module>
        <module>connectivity-flow-tooling-support</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.18.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin.version}</version>
                    <configuration>
                        <source>${maven.compiler.release}</source>
                        <target>${maven.compiler.release}</target>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </path>
                        </annotationProcessorPaths>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                    <configuration>
                        <systemPropertyVariables>
                            <java.util.logging.config.file>${pathToTop}/logging.properties</java.util.logging.config.file>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven.shade.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${maven.checkstyle.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <!--
                            CheckStyle Maven plugin uses an old version of CheckStyle by default, which has some bugs.
                            -->
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>verify-style</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <skip>${skipVerifications}</skip>
                        <logViolationsToConsole>true</logViolationsToConsole>
                        <failOnViolation>true</failOnViolation>
                        <checkstyleRules>
                            <module name="Checker">
                                <module name="TreeWalker">
                                    <module name="AvoidDoubleBraceInitialization"/>
                                    <!--<module name="AvoidNestedBlocks"/>-->
                                    <module name="AvoidNoArgumentSuperConstructorCall"/>
                                    <module name="AvoidStarImport"/>
                                    <module name="ConstantName"/>
                                    <module name="EmptyBlock"/>
                                    <module name="EmptyCatchBlock"/>
                                    <module name="EmptyStatement"/>
                                    <module name="EqualsAvoidNull"/>
                                    <module name="HideUtilityClassConstructor"/>
                                    <module name="InvalidJavadocPosition"/>
                                    <module name="JavadocBlockTagLocation"/>
                                    <module name="JavadocMethod"/>
                                    <module name="JavadocStyle"/>
                                    <module name="JavadocType">
                                        <property name="allowMissingParamTags" value="true"/>
                                        <property name="allowUnknownTags" value="true"/>
                                    </module>
                                    <module name="MissingSwitchDefault"/>
                                    <module name="NeedBraces"/>
                                    <module name="NoEnumTrailingComma"/>
                                    <module name="NoFinalizer"/>
                                    <module name="RedundantImport"/>
                                    <module name="SimplifyBooleanExpression"/>
                                    <module name="SimplifyBooleanReturn"/>
                                    <module name="UnnecessaryParentheses"/>
                                    <module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
                                    <module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
                                    <module name="UnnecessarySemicolonInEnumeration"/>
                                    <module name="UnnecessarySemicolonInTryWithResources"/>
                                    <module name="UnusedLocalVariable"/>
                                    <module name="UnusedImports"/>
                                </module>
                            </module>
                        </checkstyleRules>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.maven.plugin.version}</version>
                    <executions>
                        <execution>
                            <id>prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <formats>
                                    <format>XML</format>
                                </formats>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code</groupId>
                    <artifactId>impsort-maven-plugin</artifactId>
                    <version>${maven.impsort.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.plexus</groupId>
                            <artifactId>plexus-utils</artifactId>
                            <version>${plexus.utils.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <groups>org.mule.,com.mulesoft.,java.,javax.</groups>
                        <staticGroups>org.mule.,com.mulesoft.,java.,javax.</staticGroups>
                    </configuration>
                    <executions>
                        <execution>
                            <id>validate-imports</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>${importGoal}</goal>
                            </goals>
                            <configuration>
                                <skip>${skipVerifications}</skip>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${javaFormatter.plugin.version}</version>
                    <configuration>
                        <compilerCompliance>${maven.compiler.release}</compilerCompliance>
                        <compilerSource>${maven.compiler.release}</compilerSource>
                        <compilerTargetPlatform>${maven.compiler.release}</compilerTargetPlatform>
                        <configFile>${formatterConfigPath}</configFile>
                        <configJsFile>${formatterConfigPath}</configJsFile>
                        <aggregator>false</aggregator>
                        <executionRoot>true</executionRoot>
                        <lineEnding>LF</lineEnding>
                    </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>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license.maven.plugin.version}</version>
                <dependencies>
                    <!-- This dependency provides the license header required for the source files of this project.
                         An external artifact is used to simplify the configuration of the build as without it,
                         a cumbersome structure of relative paths per project should have been used. See EE-4843
                         for more info -->
                    <dependency>
                        <groupId>com.mulesoft.license</groupId>
                        <artifactId>license</artifactId>
                        <version>${mulesoftLicenseVersion}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <skip>${skipVerifications}</skip>
                    <header>${licensePath}</header>
                    <excludes>
                        <exclude>target/**</exclude>
                        <exclude>**/.gitignore</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.groovy</exclude>
                        <exclude>**/*.sh</exclude>
                        <exclude>**/*.bat</exclude>
                        <exclude>**/*.ftl</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/*.sample</exclude>
                        <exclude>**/*.md</exclude>
                        <exclude>**/*.xsl</exclude>
                        <exclude>**/*.html</exclude>
                        <exclude>**/*.css</exclude>
                        <exclude>**/test/resources/**</exclude>
                    </excludes>
                    <includes>
                        <include>**/*.java</include>
                        <include>**/*.dwl</include>
                    </includes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                        <dwl>SLASHSTAR_STYLE</dwl>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>mule-releases</id>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases</url>
        </repository>

        <repository>
            <id>mule-snapshots</id>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/snapshots</url>
        </repository>
    </repositories>

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

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


    <profiles>
        <!-- Publish to repository-master.mulesoft.org releases by default -->
        <profile>
            <id>mule-release</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <distributionManagement>
                <repository>
                    <id>mule-releases</id>
                    <name>MuleSoft Release Repository</name>
                    <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases</url>
                </repository>
            </distributionManagement>
        </profile>
        <!-- Publish to repository-master.mulesoft.org snapshots when this profile is active, profile activation will be done in the CICD -->
        <profile>
            <id>mule-snapshot</id>
            <distributionManagement>
                <repository>
                    <id>mule-releases</id>
                    <name>MuleSoft Release Repository</name>
                    <url>https://repository-master.mulesoft.org/nexus/content/repositories/snapshots</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>
</project>
