<?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/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.mule.distributions</groupId>
        <artifactId>mule-distributions</artifactId>
        <version>4.1.1-20210121</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>mule-standalone</artifactId>
    <!-- Packaging 'pom' ensures that maven does not try to bind a plugin to the
         'package' phase. We bind the assembly plugin here, that's enough. -->
    <packaging>pom</packaging>
    <name>Full Distribution</name>
    <description>Includes the Mule server with all of its modules and transports.</description>

    <properties>
        <formatterConfigPath>../formatter.xml</formatterConfigPath>

        <jackson2Version>2.9.4</jackson2Version>

        <libUserOutputDir>${project.build.directory}/lib/user</libUserOutputDir>

        <libPatchesOutputDir>${project.build.directory}/lib/patches</libPatchesOutputDir>
        <muleArtifactsPatchesOutputDir>${libPatchesOutputDir}/mule-artifact-patches</muleArtifactsPatchesOutputDir>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-container-app-plugins-jar-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/plugins</outputDirectory>
                            <includeTypes>jar</includeTypes>
                            <includeGroupIds>
                                org.mule.modules
                            </includeGroupIds>
                            <includeClassifiers>mule-plugin</includeClassifiers>
                            <excludeArtifactIds>mule-service-http</excludeArtifactIds>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-additional-services</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.mule.services</groupId>
                                    <artifactId>mule-service-weave</artifactId>
                                    <version>${weaveVersion}</version>
                                    <classifier>mule-service</classifier>
                                    <outputDirectory>${project.build.directory}/services</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-lib-patches-jars</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <!-- Lib Patches -->
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>MULE-17243-${mule.version}</artifactId>
                                    <version>3.0</version>
                                    <type>jar</type>
                                    <outputDirectory>${libUserOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>MULE-19140-${mule.version}</artifactId>
                                    <version>1.1</version>
                                    <type>jar</type>
                                    <outputDirectory>${libUserOutputDir}</outputDirectory>
                                </artifactItem>

                                <!-- Mule Artifact patches -->
                                <!--   SE-12551   -->
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>SE-12551-1.0.0-1.0.1</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>SE-12551-1.1.0-1.1.15</artifactId>
                                    <version>2.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>SE-12551-1.2.0-1.3.0</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>SE-12551-1.3.1-1.3.4</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.patches</groupId>
                                    <artifactId>SE-12562-1.0.0-1.5.5</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>

                                <!--   APIKIT-2612 / APIKIT-2613   -->
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.0.0-1.0.2-1.1.0</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.1</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.2</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.3</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.4</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.5-1.1.6</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.7</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.8-1.1.10</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.11</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.12-1.2.0-1.2.2</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.13-1.1.14-1.2.3-1.2.4</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.1.15-1.1.16</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.3.0</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.2.5-1.3.1-1.3.4</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2612-1.3.5-1.3.9</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.2.0-1.2.1</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.2.2</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.2.3-1.2.4-1.3.0</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.2.5-1.3.1-1.3.4</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.3.5-1.3.6</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.3.7-1.3.8</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.mulesoft.mule.artifact.patches</groupId>
                                    <artifactId>APIKIT-2613-1.3.9</artifactId>
                                    <version>1.0</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${muleArtifactsPatchesOutputDir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                    <tarLongFileMode>posix</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <!--
                                'single' ensures there's only a single run bound to m2's lifecycle.
                                The default 'assembly' goal would run every plugin in this pom twice.
                            -->
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--
                Create a dummy javadoc folder so the assembly always succeeds
                even without a full site run.
             -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <mkdir dir="../../../target/site/apidocs"/>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.mule.tools</groupId>
                <artifactId>mule-assembly-verifier</artifactId>
            </plugin>

            <!--
                 We generate a full source bundle using the groovy plugin above. Do not
                 publish maven's autogenerated and empty sources jar of this module.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>false</attach>
                </configuration>
            </plugin>

            <plugin>
                <groupId>net.nicoulaj.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>artifacts</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <attachChecksums>true</attachChecksums>
                    <algorithms>
                        <algorithm>SHA-256</algorithm>
                    </algorithms>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- Mule Core -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <!-- Include all Mule Modules -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-modules-all</artifactId>
            <version>${mule.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Include all Mule Services -->
        <dependency>
            <groupId>org.mule.distributions</groupId>
            <artifactId>mule-services-all</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
            <exclusions>
                <!--TODO(gfernandes): remove this, see validation's comment-->
                <exclusion>
                    <artifactId>mule-service-weave</artifactId>
                    <groupId>org.mule.services</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Modules for standalone container -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-reboot</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-launcher</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-deployment</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-service</artifactId>
            <version>${mule.version}</version>
        </dependency>

        <!-- add aspectj weaver dependency that was removed from spring-security-3.1 -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mule.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>${javaXmlBindVersion}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.xml.stream</groupId>
                    <artifactId>stax-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Groovy is required to execute the launcher script -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <classifier>indy</classifier>
        </dependency>

        <!-- Overwrite Jackson dependency with our own version -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson2Version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson2Version}</version>
        </dependency>
    </dependencies>
</project>
