<?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.runtime</groupId>
        <artifactId>mule-modules</artifactId>
        <version>4.7.4</version>
    </parent>
    <artifactId>mule-module-service</artifactId>
    <name>Mule Services</name>
    <description>Mule service module. Provides services support to Mule container.</description>

    <properties>
        <javaModuleName>org.mule.runtime.service</javaModuleName>
        <skipExportTests>false</skipExportTests>
        <formatterConfigPath>../../formatter.xml</formatterConfigPath>
        <project.build.java11SourceDirectory>${project.basedir}/src/main/java11</project.build.java11SourceDirectory>
        <project.build.java11TestSourceDirectory>${project.basedir}/src/test/java11</project.build.java11TestSourceDirectory>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <configuration>
                    <directories>
                        <directory>${project.build.sourceDirectory}</directory>
                        <directory>${project.build.testSourceDirectory}</directory>
                        <directory>${project.build.java11SourceDirectory}</directory>
                        <directory>${project.build.java11TestSourceDirectory}</directory>
                    </directories>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile-java-11</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <release>11</release>
                            <compileSourceRoots>
                                <compileSourceRoot>${project.build.java11SourceDirectory}</compileSourceRoot>
                            </compileSourceRoots>
                            <multiReleaseOutput>true</multiReleaseOutput>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Multi-Release>true</Multi-Release>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
	        <plugin>
	            <groupId>org.codehaus.mojo</groupId>
	            <artifactId>build-helper-maven-plugin</artifactId>
	            <executions>
	                <execution>
                        <!-- Add the java 11 sources to the source artifact -->
	                	<id>attach-java11-sources</id>
	                	<!-- This has to run after compilation so it doesn't interfere with it (compler has its own MRJAR configuration) -->
	                    <phase>prepare-package</phase>
	                    <goals>
	                        <goal>add-source</goal>
	                    </goals>
	                    <configuration>
	                        <sources>
	                            <source>src/main/java11</source>
	                        </sources>
	                    </configuration>
	                </execution>
	            </executions>
	        </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mule.runtime.boot</groupId>
            <artifactId>mule-module-jpms-utils</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-container</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-artifact</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-unit</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-allure</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-maven-pom-parser-impl</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.tools.maven</groupId>
            <artifactId>mule-classloader-model</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
    </dependencies>
</project>
