<?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/xsd/maven-4.0.0.xsd">

    <!--

        Licensed to the Apache Software Foundation (ASF) under one or more
        contributor license agreements.  See the NOTICE file distributed with
        this work for additional information regarding copyright ownership.
        The ASF licenses this file to You under the Apache License, Version 2.0
        (the "License"); you may not use this file except in compliance with
        the License.  You may obtain a copy of the License at

           http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
    -->

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.servicemix</groupId>
        <artifactId>assemblies</artifactId>
        <version>4.5.0.redhat-60065</version>
    </parent>

    <artifactId>apache-servicemix</artifactId>
    <packaging>pom</packaging>
    <name>Apache ServiceMix :: Features :: Assemblies :: Apache ServiceMix</name>

    <dependencies>
        <dependency>
            <groupId>org.apache.servicemix.assemblies</groupId>
            <artifactId>shared</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Download Karaf assemblies for dependency:unpack-->
        <dependency>
            <groupId>org.apache.karaf</groupId>
            <artifactId>apache-karaf</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.apache.karaf</groupId>
            <artifactId>apache-karaf</artifactId>
            <type>tar.gz</type>
        </dependency>

        <!--Xerces jar to be included in lib/endorsed -->
        <dependency>
            <groupId>org.apache.xerces</groupId>
            <artifactId>xml-apis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>

        <!--xalan jar to be included in lib/endorsed-->
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
        </dependency>

        <!-- branding -->
        <dependency>
            <groupId>org.apache.servicemix.features</groupId>
            <artifactId>org.apache.servicemix.features.branding</artifactId>
        </dependency>
        
    </dependencies>
    
    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/filtered-resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <configuration>
                    <appendedResourcesDirectory>${basedir}/target/shared/appended-resources</appendedResourcesDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>features-maven-plugin</artifactId>
                <version>${karaf.version}</version>
                <executions>
                    <execution>
                        <id>add-features-to-repo</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>add-features-to-repo</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>mvn:org.apache.karaf.assemblies.features/standard/${karaf.version}/xml/features</descriptor>
                                <descriptor>mvn:org.apache.karaf.assemblies.features/enterprise/${karaf.version}/xml/features</descriptor>
                                <descriptor>mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/${servicemix.nmr.version}/xml/features</descriptor>
                                <descriptor>mvn:org.apache.activemq/activemq-karaf/${activemq.version}/xml/features</descriptor>
                                <descriptor>mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features</descriptor>
                                <descriptor>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</descriptor>
                                <descriptor>file:${basedir}/target/classes/features.xml</descriptor>
                            </descriptors>
                            <features>
                                <feature>cxf</feature>
                                <feature>obr</feature>
                                <feature>config</feature>
                                <feature>activemq-broker</feature>
                                <feature>camel</feature>
                                <feature>camel-activemq</feature>
                                <feature>camel-cxf</feature>
                                <feature>camel-blueprint</feature>
                                <feature>war</feature>
                            </features>
                            <includeMvnBasedDescriptors>true</includeMvnBasedDescriptors>
                            <repository>target/features-repo</repository>
                        </configuration>
                        <inherited>false</inherited>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>filter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>copy-system-folder</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/features-repo</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/dependencies/unix/apache-karaf-${karaf.version}/system</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-shared</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                          <artifactItems>
                            <artifactItem>
                              <groupId>org.apache.servicemix.assemblies</groupId>
                              <artifactId>shared</artifactId>
                              <type>jar</type>
                              <outputDirectory>target/shared</outputDirectory>
                            </artifactItem>
                            <artifactItem>
                              <groupId>org.apache.xerces</groupId>
                              <artifactId>xercesImpl</artifactId>
                              <outputDirectory>target/dependencies/endorsed</outputDirectory>
                            </artifactItem>
                            <artifactItem>
                              <groupId>org.apache.xerces</groupId>
                              <artifactId>xml-apis</artifactId>
                              <outputDirectory>target/dependencies/endorsed</outputDirectory>
                            </artifactItem>
                            <artifactItem>
                              <groupId>xalan</groupId>
                              <artifactId>xalan</artifactId>
                              <outputDirectory>target/dependencies/endorsed</outputDirectory>
                            </artifactItem>
                            <artifactItem>
                              <groupId>xalan</groupId>
                              <artifactId>serializer</artifactId>
                              <outputDirectory>target/dependencies/endorsed</outputDirectory>
                            </artifactItem>
                          </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-unix</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.karaf</groupId>
                                    <artifactId>apache-karaf</artifactId>
                                    <type>tar.gz</type>
                                    <outputDirectory>target/dependencies/unix</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-win</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.karaf</groupId>
                                    <artifactId>apache-karaf</artifactId>
                                    <type>zip</type>
                                    <outputDirectory>target/dependencies/win</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                 <groupId>org.fusesource.mvnplugins</groupId>
                 <artifactId>maven-notices-plugin</artifactId>
                 <version>1.26</version>
                 <executions>
                     <execution>
                         <id>merge-notices-in-repository</id>
                         <phase>package</phase>
                         <goals>
                             <goal>merge-notices-in-repository</goal>
                         </goals>
                         <configuration>
                             <projectName>Fuse ESB</projectName>
                             <organizationName>FuseSource, Corp. All Rights Reserved.</organizationName>
                             <organizationURL>http://fusesource.com</organizationURL>
                             <preamble>In addition to the FuseSource products, this disk contains certain third party software or components (“Third Party Components”), which are bundled as separate files or modules and separately licensed to you by said third parties. This file contains a listing of all NOTICE/NOTICE.txt files included with the Third Party Component jars in this distribution of Fuse ESB. Please see the esb_dependencies.txt file for the complete listing of Third Party Components and their attributed license agreements.  Your use of the Third Party Components is subject to the terms and conditions set forth in the applicable third party license agreement.  The Third Party Components are provided by FuseSource Corporation (“FSC”) solely on an "AS IS" basis, without any warranty.  FSC disclaims all warranties and indemnities with respect to the Third Party Components, express or implied, and assumes no liability with respect to the Third Party Components.  You acknowledge that the authors of the Third Party Components have no obligation to provide support to you for the Third Party Components.  You hereby undertake to comply with all licenses related to the applicable Third Party Components. All third party license agreements are contained in the licenses directory of </preamble>
                             <listDependencies>true</listDependencies>
                             <extraDependencies>org.apache.xerces:xercesImpl:2.11.0,xalan:xalan:2.7.1,xalan:serializer:2.7.1</extraDependencies>
                             <noticeSupplements>classes/notice-supplements.xml</noticeSupplements>
                             <repositories>${project.basedir}/target/features-repo,${project.basedir}/target/dependencies/endorsed,${project.basedir}/target/dependencies/unix/apache-karaf-${karaf.version}/lib,${project.basedir}/target/dependencies/unix/apache-karaf-${karaf.version}/system</repositories>
                             <defaultParent>org.apache.servicemix:assemblies:${project.version}</defaultParent>
                        </configuration>
                     </execution>
                 </executions>
             </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enable-obr</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target name="enable-obr">
                                <echo message="Updating etc/startup.properties in unix assembly" />
                                <concat destfile="target/dependencies/unix/apache-karaf-${karaf.version}/etc/startup.properties" append="true" eol="unix">
                                    <fileset file="target/shared/startup-obr.properties" />
                                </concat>
                                <echo message="Updating etc/startup.properties in windows assembly" />
                                <concat destfile="target/dependencies/win/apache-karaf-${karaf.version}/etc/startup.properties" append="true" eol="dos">
                                    <fileset file="target/shared/startup-obr.properties" />
                                </concat>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <inherited>false</inherited>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/classes/features.xml</file>
                                    <type>xml</type>
                                    <classifier>features</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <executions>
                    <execution>
                        <id>unix-bin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/descriptors/unix-bin.xml</descriptor>
                            </descriptors>
                            <finalName>${project.artifactId}-${project.version}</finalName>
                            <tarLongFileMode>gnu</tarLongFileMode>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                    <execution>
                        <id>windows-bin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/descriptors/windows-bin.xml</descriptor>
                            </descriptors>
                            <finalName>${project.artifactId}-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unix-src</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>attached</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/descriptors/unix-src.xml</descriptor>
                                    </descriptors>
                                </configuration>
                                <inherited>false</inherited>
                            </execution>
                            <execution>
                                <id>windows-src</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>attached</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/descriptors/windows-src.xml</descriptor>
                                    </descriptors>
                                </configuration>
                                <inherited>false</inherited>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

