<?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.6.0</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 APIs and internal modules.</description>

    <properties>
        <standaloneStructureDir>${project.build.directory}/distribution-structure</standaloneStructureDir>
        <standaloneStructure>mule-standalone-structure</standaloneStructure>
        
        <formatterConfigPath>../formatter.xml</formatterConfigPath>
    </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>unpack-dependencies</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.mule.distributions</groupId>
                                    <artifactId>${standaloneStructure}</artifactId>
                                    <version>${project.version}</version>
                                    <type>tar.gz</type>
                                    <outputDirectory>${standaloneStructureDir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/assembly/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>

            <plugin>
                <groupId>org.mule.tools</groupId>
                <artifactId>mule-assembly-verifier</artifactId>
                <configuration>
                    <skip>${skipVerifications}</skip>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </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>

        </plugins>
    </build>

    <dependencies>
        <!-- Mule distribution structure -->
        <dependency>
            <groupId>org.mule.distributions</groupId>
            <artifactId>${standaloneStructure}</artifactId>
            <version>${project.version}</version>
            <type>tar.gz</type>
        </dependency>

        <!-- Mule Core -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Include all Mule Modules -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-modules-all</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.module</groupId>
                    <artifactId>jackson-module-jsonSchema</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>
        </dependency>

        <!-- Add mule-dwb-api dep used by the DW mule-service-weave -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-dwb-api</artifactId>
        </dependency>

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

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

        <!-- Overwrite Jackson dependency with our own version -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jsonSchema</artifactId>
        </dependency>

        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mule.distributions</groupId>
            <artifactId>mule-wrapper-additional-parameters-parser</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</project>
