<?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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.mule.distributions</groupId>
        <artifactId>mule-distributions</artifactId>
        <version>3.3.0</version>
    </parent>
    <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-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>

            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                // splash
                                log.info '*' * 80
                                log.info('Repackaging sources'.center(80))
                                log.info('(full build with a source:jar target must have run before)'.center(80))
                                log.info '*' * 80

                                def muleRoot = "$project.build.directory/../../../"

                                log.info("Mule project root: ${new File(muleRoot).canonicalPath}")

                                def tempDir = "$project.build.directory/sources-temp"
                                ant.mkdir(dir: tempDir)

                                ant.unjar(dest: tempDir) {
                                    fileset(dir: muleRoot) {
                                        include(name: '**/*-sources.jar')
                                        exclude(name: 'osgi-libs/**/*-sources.jar')
                                    }
                                }

                                ant.zip(basedir: tempDir,
                                        destfile: "$project.build.directory/mule-${project.version}-src.zip")
                            </source>
                        </configuration>
                    </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 Core -->
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Include all Mule Example Apps -->
        <dependency>
            <groupId>org.mule.examples</groupId>
            <artifactId>mule-examples-all</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-cep</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-errorhandler</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-geomail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-loanbroker-bpm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-loanbroker-legacy</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-loanbroker-simple</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.examples</groupId>
                    <artifactId>mule-example-notifications</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Include all Mule Modules -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-modules-all</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>org.mule.modules.jca</groupId>
                    <artifactId>mule-module-jca-generic</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mule.modules.jca</groupId>
                    <artifactId>mule-module-jca-jboss</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Modules for standalone container -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-reboot</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-launcher</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-logging</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Include all Mule Patterns -->
        <dependency>
            <groupId>org.mule.patterns</groupId>
            <artifactId>mule-patterns-all</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
        <!-- Include all Mule Transports -->
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transports-all</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </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>
            <version>1.3.04</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xml-serializer</artifactId>
            <version>2.7.1</version>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.1</version>
            <exclusions>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>serializer</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- make sure we package the test frameworks, too -->
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-core</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
        </dependency>

        <!-- include the ant tasks, so users can point to them, in lib/opt -->
        <dependency>
            <groupId>org.mule.tools</groupId>
            <artifactId>mule-tools-anttasks</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
        </dependency>

        <!--
            Activemq is a transitive dependency from the errorhandler example.
            Make sure it doesn't end up in the standalone distro.
        -->
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--
            derby is a transitive dependency from the loanbroker-bpm example.
            Make sure it doesn't end up in the standalone distro.
        -->
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--
            Exclude the transitive dependencies of the scripting example
         -->
        <dependency>
            <groupId>javax.script</groupId>
            <artifactId>jython-engine</artifactId>
            <classifier>jdk14</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.python</groupId>
            <artifactId>jython</artifactId>
            <scope>provided</scope>
        </dependency>
        <!--
            Exclude the transitive dependencies of the bookstore example
         -->
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1-jetty</artifactId>
            <version>${jettyVersion}</version>
            <scope>provided</scope>
        </dependency>
        <!--
            Exclude the transitive dependencies of the mule example launcher
         -->
        <dependency>
            <groupId>net.htmlparser.jericho</groupId>
            <artifactId>jericho-html</artifactId>
            <version>3.2</version>
            <scope>provided</scope>
        </dependency>
        <!-- re-add our ant dependency as it gets transitively excluded by jetty's jsp support -->
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>${antVersion}</version>

        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
            <version>2.7.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
