<?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>
    <parent>
        <groupId>org.mule.extensions</groupId>
        <artifactId>mule-core-modules-parent</artifactId>
        <version>1.1.5</version>
    </parent>

    <groupId>com.mulesoft.munit</groupId>
    <artifactId>munit-tools</artifactId>
    <version>2.2.4</version>
    <packaging>mule-extension</packaging>

    <name>MUnit :: Tools Extension</name>
    <description>SDK based Mule plugin defining the DSL for assertion and mock processors</description>

    <properties>
        <commons.lang3.version>3.6</commons.lang3.version>
        <guava.version>19.0</guava.version>
        <weave.assertions.version>1.0.0</weave.assertions.version>
        <jakarta.activation.version>1.2.1</jakarta.activation.version>
        <mule.os.connector.version>1.1.3</mule.os.connector.version>

        <!-- Plugin Versions -->
        <findbugs.maven.plugin.version>3.0.4</findbugs.maven.plugin.version>
        <checkstyle.plugin.version>2.17</checkstyle.plugin.version>
        <checkstyle.version>8.0</checkstyle.version>
        <javaFormatter.plugin.version>2.0.1</javaFormatter.plugin.version>
        <license.maven.plugin.version>2.8</license.maven.plugin.version>
        <maven.javadoc.plugin.version>2.10.4</maven.javadoc.plugin.version>

        <licensePath>../../LICENSE_HEADER.txt</licensePath>
        <formatterConfigPath>../../formatter.xml</formatterConfigPath>
        <findbugsExcludePath>../../findbugs-exclude.xml</findbugsExcludePath>

        <jacoco.maven.plugin.version>0.7.9</jacoco.maven.plugin.version>
        <jacoco.report.location>${session.executionRootDirectory}/target/jacoco.exec</jacoco.report.location>
        <coverageLineLimit>0.79</coverageLineLimit>
        <coverageBranchLimit>0.92</coverageBranchLimit>
        <skipTests>false</skipTests>
        <skipJaCoCoCoverage>${skipTests}</skipJaCoCoCoverage>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license.maven.plugin.version}</version>
                <configuration>
                    <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>
                    </excludes>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <skip>${skipVerifications}</skip>
                    <configLocation>../../munit_check.xml</configLocation>
                    <failOnViolation>true</failOnViolation>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                            <goal>checkstyle-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>${findbugs.maven.plugin.version}</version>
                <configuration>
                    <xmlOutput>true</xmlOutput>
                    <threshold>High</threshold>
                    <skip>${skipVerifications}</skip>
                    <failOnError>true</failOnError>
                    <excludeFilterFile>${findbugsExcludePath}</excludeFilterFile>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>findbugs</goal>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <haltOnFailure>false</haltOnFailure>
                    <skip>${skipJaCoCoCoverage}</skip>
                    <append>true</append>
                    <destFile>${jacoco.report.location}</destFile>
                    <dataFile>${jacoco.report.location}</dataFile>
                    <rules>
                        <rule>
                            <element>BUNDLE</element>
                            <limits>
                                <limit>
                                    <counter>LINE</counter>
                                    <value>COVEREDRATIO</value>
                                    <minimum>${coverageLineLimit}</minimum>
                                </limit>
                                <limit>
                                    <counter>BRANCH</counter>
                                    <value>COVEREDRATIO</value>
                                    <minimum>${coverageBranchLimit}</minimum>
                                </limit>
                            </limits>
                        </rule>
                    </rules>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>${findbugs.maven.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.maven.plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <dependencies>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-assert</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-mock</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.weave</groupId>
            <artifactId>assertions</artifactId>
            <version>${weave.assertions.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons.lang3.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>jakarta.activation</artifactId>
            <version>${jakarta.activation.version}</version>
        </dependency>

        <!--TODO Workaround for MULE-11650-->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-objectstore-connector</artifactId>
            <version>${mule.os.connector.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>

    </dependencies>
</project>
