<?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.0.0-FD.1</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>

    <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>
                                    <type>zip</type>
                                    <outputDirectory>${project.build.directory}/services</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                    <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <!--
                                'attached' 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>attached</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>

        </plugins>
    </build>

    <dependencies>
        <!-- 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>
            </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>${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>

        <!--
            We need to register the endorsed XML jars as dependencies of the
            distribution, so that they can be referenced in the assembly as in/excludes.
        -->
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
        </dependency>

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

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</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>
    </dependencies>
</project>
