<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>
    <groupId>com.iona.fuse</groupId>
    <artifactId>installer-source</artifactId>
    <version>1.3.2</version>
    <name>FUSE Installer - Source</name>
    <url></url>

    <parent>
        <groupId>com.iona.fuse</groupId>
        <artifactId>installer</artifactId>
        <version>1.3.2</version>
    </parent>

    <packaging>pom</packaging>

    <build>
        <plugins>
            <!-- Download into target directory -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>get_cxf_src</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.cxf</groupId>
                                    <artifactId>apache-cxf</artifactId>
                                    <version>${cxf.version}</version>
                                    <classifier>src</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>get_camel_src</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.camel</groupId>
                                    <artifactId>apache-camel</artifactId>
                                    <version>${camel.version}</version>
                                    <classifier>src</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>get_activemq_src</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.activemq</groupId>
                                    <artifactId>apache-activemq</artifactId>
                                    <version>${activemq.version}</version>
                                    <classifier>src</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>get_servicemix_src</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.servicemix</groupId>
                                    <artifactId>apache-servicemix</artifactId>
                                    <version>${servicemix.version}</version>
                                    <classifier>src</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin> 

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>remove-iona_samples-reference</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <replace dir="target/apache-cxf-${cxf.version}-src" token="&lt;module&gt;iona_samples&lt;/module&gt;" value="" casesensitive="false">
                                      <include name="pom.xml"/>
                                </replace>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Copy only what we want into the stage-bin directory --> 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>stage-src</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly/stage-source.xml</descriptor>                                
                            </descriptors>
                            <finalName>stage</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin> 

            <!-- Re-deploy to the same location as the binary installers --> 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-src-installer</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>                        
                            <repositoryId>local</repositoryId>
                            <file>target/stage-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-services-framework</artifactId>
                            <version>${services.framework.version}</version>
                            <classifier>${distribution.classifier}</classifier>   
                            <packaging>zip</packaging>                       
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-camel</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <repositoryId>local</repositoryId>
                            <file>target/apache-camel-${camel.version}-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-mediation-router</artifactId>
                            <version>${mediation.router.version}</version>
                            <classifier>${distribution.classifier}</classifier>
                            <packaging>zip</packaging>
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-activemq</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <repositoryId>local</repositoryId>
                            <file>target/apache-activemq-${activemq.version}-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-message-broker</artifactId>
                            <version>${message.broker.version}</version>
                            <classifier>${distribution.classifier}</classifier>
                            <packaging>zip</packaging>
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-servicemix</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <repositoryId>local</repositoryId>
                            <file>target/apache-servicemix-${servicemix.version}-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-esb</artifactId>
                            <version>${esb.version}</version>
                            <classifier>${distribution.classifier}</classifier>
                            <packaging>zip</packaging>
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <executions>
                    <execution>
                        <id>deploy-src-installer</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <url>${maven.current.repo}</url>
                            <repositoryId>local</repositoryId>
                            <file>target/stage-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-services-framework</artifactId>
                            <version>${services.framework.version}</version>
                            <classifier>${distribution.classifier}</classifier> 
                            <packaging>zip</packaging>                      
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-camel</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <url>${maven.current.repo}</url>
                            <repositoryId>local</repositoryId>
                            <file>target/apache-camel-${camel.version}-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-mediation-router</artifactId>
                            <version>${mediation.router.version}</version>
                            <classifier>${distribution.classifier}</classifier>
                            <packaging>zip</packaging>
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-activemq</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <url>${maven.current.repo}</url>
                            <repositoryId>local</repositoryId>
                            <file>target/apache-activemq-${activemq.version}-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-message-broker</artifactId>
                            <version>${message.broker.version}</version>
                            <classifier>${distribution.classifier}</classifier>
                            <packaging>zip</packaging>
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-servicemix</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <url>${maven.current.repo}</url>
                            <repositoryId>local</repositoryId>
                            <file>target/apache-servicemix-${servicemix.version}-src.zip</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>fuse-esb</artifactId>
                            <version>${esb.version}</version>
                            <classifier>${distribution.classifier}</classifier>
                            <packaging>zip</packaging>
                            <uniqueVersion>false</uniqueVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
