<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) FuseSource, Inc.
  http://fusesource.com

  Licensed 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.
  -->

<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">
    <parent>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric-project</artifactId>
        <version>1.1.0.Beta1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>fabric8-karaf</artifactId>
    <name>Fabric8 :: Binary Distribution</name>
    <packaging>pom</packaging>

        <dependencies>
           <!-- Karaf Dependencies -->
           <dependency>
               <groupId>org.apache.karaf</groupId>
               <artifactId>apache-karaf</artifactId>
               <version>${karaf-version}</version>
               <scope>provided</scope>
               <type>tar.gz</type>
           </dependency>
           <dependency>
               <groupId>org.apache.karaf</groupId>
               <artifactId>apache-karaf</artifactId>
               <version>${karaf-version}</version>
               <scope>provided</scope>
               <type>zip</type>
           </dependency>
           
            <!-- Gravia Dependencies -->
            <dependency>
                <groupId>org.jboss.gravia</groupId>
                <artifactId>gravia-provision</artifactId>
            </dependency>
            <dependency>
                <groupId>org.jboss.gravia</groupId>
                <artifactId>gravia-resource</artifactId>
            </dependency>
            <dependency>
                <groupId>org.jboss.gravia</groupId>
                <artifactId>gravia-repository</artifactId>
            </dependency>
            <dependency>
                <groupId>org.jboss.gravia</groupId>
                <artifactId>gravia-resolver</artifactId>
            </dependency>
            <dependency>
                <groupId>org.jboss.gravia</groupId>
                <artifactId>gravia-runtime-api</artifactId>
            </dependency>
            <dependency>
                <groupId>org.jboss.gravia</groupId>
                <artifactId>gravia-runtime-osgi</artifactId>
            </dependency>

           <!-- Fabric Dependencies -->
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-agent</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-agent-commands</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-camel</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-boot-commands</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-core</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-core-agent-ssh</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-commands</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-zookeeper-commands</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-configadmin</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-dosgi</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-extender-listener</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-features-service</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-git</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-git-hawtio</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-git-server</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-jaas</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-jolokia</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-ldap</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-partition</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-project-deployer</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-redirect</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-web</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-zeroconf</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-zookeeper</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8.fab</groupId>
               <artifactId>fab-osgi</artifactId>
           </dependency>
           <dependency>
                <groupId>io.fabric8.insight</groupId>
                <artifactId>insight-elasticsearch</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8.insight</groupId>
               <artifactId>insight-log</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8.insight</groupId>
               <artifactId>insight-log-storage</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8.insight</groupId>
               <artifactId>insight-metrics</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>process-fabric</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>process-manager</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>io.fabric8.karaf.branding</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8.mq</groupId>
               <artifactId>mq-fabric</artifactId>
           </dependency>
           <dependency>
             <groupId>io.fabric8</groupId>
             <artifactId>gateway-core</artifactId>
           </dependency>
           <dependency>
             <groupId>io.fabric8</groupId>
             <artifactId>gateway-fabric</artifactId>
           </dependency>
           <dependency>
             <groupId>io.fabric8</groupId>
             <artifactId>gateway-fabric-haproxy</artifactId>
           </dependency>
           <dependency>
               <groupId>io.fabric8</groupId>
               <artifactId>fabric-maven-proxy</artifactId>
           </dependency>

           <!-- need this transitive of org.apache.servicemix.bundles.jasypt
                to get this building in offline mode -->
           <dependency>
               <groupId>commons-codec</groupId>
               <artifactId>commons-codec</artifactId>
           </dependency>

           <!-- for jolokia -->
           <dependency>
               <groupId>org.jolokia</groupId>
               <artifactId>jolokia-osgi</artifactId>
               <version>${jolokia-version}</version>
           </dependency>

         <!-- these are copied to the lib folder -->
        <dependency>
            <groupId>org.apache.xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>${xerces.version}</version>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>${xalan.version}</version>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
            <version>${xalan.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.specs</groupId>
            <artifactId>org.apache.servicemix.specs.activator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.specs</groupId>
            <artifactId>org.apache.servicemix.specs.jaxp-api-1.4</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.specs</groupId>
            <artifactId>org.apache.servicemix.specs.jaxws-api-2.2</artifactId>
        </dependency>

           <!-- fix transient dependency version issue when building ESB... -->
           <dependency>
               <groupId>org.apache.aries.proxy</groupId>
               <artifactId>org.apache.aries.proxy</artifactId>
              <version>${aries-proxy-version}</version>
           </dependency>
           <dependency>
               <groupId>org.apache.aries.proxy</groupId>
               <artifactId>org.apache.aries.proxy.impl</artifactId>
               <version>${aries-proxy-impl-version}</version>
           </dependency>
           <dependency>
               <groupId>org.apache.aries.proxy</groupId>
               <artifactId>org.apache.aries.proxy.api</artifactId>
               <version>${aries-proxy-api-version}</version>
           </dependency>
       </dependencies>

       <build>
           <resources>
             <resource>
                 <directory>${basedir}/../../etc</directory>
                 <filtering>true</filtering>
                 <targetPath>distro/etc</targetPath>
             </resource>
               <resource>
                   <directory>src/main/resources</directory>
                   <filtering>true</filtering>
               </resource>
           </resources>
           <plugins>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-resources-plugin</artifactId>
                   <executions>
                       <execution>
                           <id>filter</id>
                           <phase>process-resources</phase>
                           <goals>
                               <goal>resources</goal>
                           </goals>
                       </execution>
                   </executions>
               </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>generate-resources</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/spring/${karaf-version}/xml/features</descriptor>
                                   <descriptor>mvn:org.apache.camel.karaf/apache-camel/${camel-version}/xml/features</descriptor>
                                   <descriptor>mvn:org.apache.activemq/activemq-karaf/${activemq-version}/xml/features</descriptor>
                                   <descriptor>mvn:org.drools/drools-karaf-features/${drools-version}/xml/features</descriptor>
                                   <descriptor>mvn:io.hawt/hawtio-karaf/${hawtio-version}/xml/features</descriptor>
                                   <descriptor>file:${basedir}/target/classes/fabric-features.xml</descriptor>
                               </descriptors>
                               <features>
                                   <feature>karaf</feature>
                                   <feature>scr</feature>
                                   <feature>war</feature>
                                   <feature>fabric-agent</feature>
                                   <feature>fabric-agent-commands</feature>
                                   <feature>fabric-boot-commands</feature>
                                   <feature>fabric-commands</feature>
                                   <feature>fabric-zookeeper-commands</feature>
                                   <feature>fabric-ssh</feature>
                                   <feature>fabric-git</feature>
                                   <feature>fabric-git-server</feature>
                                   <feature>fabric-maven-proxy</feature>
                                   <feature>fabric-camel</feature>
                                   <feature>fabric-dosgi</feature>
                                   <feature>fabric-bundle</feature>
                                   <feature>fabric-jaas</feature>
                                   <feature>fabric-web</feature>
                                   <feature>gravia</feature>
<!--
TODO - zapped to try fix perfectus!
                                   <feature>mq-fabric</feature>
-->
                                   <feature>insight-elasticsearch</feature>
                                   <feature>insight-log-storage</feature>
                                   <feature>process-manager</feature>
                                   <feature>jolokia</feature>
                                   <feature>fabric-redirect</feature>
                                   <feature>fabric-hawtio</feature>
                                   <feature>fabric-hawtio-swagger</feature>
                                   <feature>hawtio-karaf-terminal</feature>
                               </features>
                               <includeMvnBasedDescriptors>true</includeMvnBasedDescriptors>
                               <repository>target/features-repo</repository>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-antrun-plugin</artifactId>
                   <executions>
                       <execution>
                           <id>update-properties</id>
                           <phase>prepare-package</phase>
                           <goals>
                               <goal>run</goal>
                           </goals>
                           <configuration>
                               <target name="update-properties">
                                   <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/classes/etc/startup.properties" />
                                   </concat>
                                   
                                   <echo message="Updating etc/config.properties in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/etc/config.properties" append="true" eol="unix">
                                       <fileset file="src/main/append-resources/common/etc/config.properties" />
                                   </concat>

                                   <echo message="Updating etc/custom.properties in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/etc/custom.properties" append="true" eol="unix">
                                        <fileset file="src/main/append-resources/common/etc/custom.properties" />
                                   </concat>
                                   
                                   <echo message="Updating etc/org.ops4j.pax.logging.cfg in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/etc/org.ops4j.pax.logging.cfg" append="true" eol="unix">
                                       <fileset file="src/main/append-resources/common/etc/org.ops4j.pax.logging.cfg" />
                                   </concat>

                                   <echo message="Updating etc/system.properties in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/etc/system.properties" append="true" eol="unix">
                                       <fileset file="src/main/append-resources/common/etc/system.properties" />
                                   </concat>

                                   <echo message="Updating etc/shell.init.script in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/etc/shell.init.script" append="true" eol="unix">
                                       <fileset file="src/main/append-resources/common/etc/shell.init.script" />
                                   </concat>

                                   <echo message="Copying bin/fabric8 in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/bin/fabric8" append="true" eol="unix">
                                       <fileset file="src/main/append-resources/unix/fabric8" />
                                   </concat>
                                   <echo message="Copying bin/fabric8.bat in windows assembly" />
                                   <concat destfile="target/dependencies/win/apache-karaf-${karaf-version}/bin/fabric8.bat" append="true" eol="dos">
                                       <fileset file="src/main/append-resources/win/fabric8.bat" />
                                   </concat>
                                   <echo message="Copying bin/standalone in unix assembly" />
                                   <concat destfile="target/dependencies/unix/apache-karaf-${karaf-version}/bin/standalone" append="true" eol="unix">
                                       <fileset file="src/main/append-resources/unix/standalone" />
                                   </concat>
                                   <echo message="Copying bin/standalone.bat in windows assembly" />
                                   <concat destfile="target/dependencies/win/apache-karaf-${karaf-version}/bin/standalone.bat" append="true" eol="dos">
                                       <fileset file="src/main/append-resources/win/standalone.bat" />
                                   </concat>

                                  <!-- now lets add to the initial import profile metadata -->
                                  <property name="dest.profiles" value="${basedir}/target/classes/distro/fabric/import/fabric/profiles" />
                                  <property name="quickstart.src" value="${basedir}/../../quickstarts" />

                                  <!-- documentation -->
                                 <copy todir="${dest.profiles}/docs/fabric">
                                   <fileset dir="${basedir}/../../docs">
                                   </fileset>
                                 </copy>

                                  <!-- quickstarts -->
                                  <copy todir="${dest.profiles}/example/quickstarts/eip.profile/data">
                                    <fileset dir="${quickstart.src}/eip/src/main/resources/data">
                                      <include name="**/*.xml" />
                                    </fileset>
                                  </copy>
                                  <copy todir="${dest.profiles}/example/quickstarts/cbr.profile/data">
                                    <fileset dir="${quickstart.src}/cbr/src/main/resources/data">
                                      <include name="**/*.xml" />
                                    </fileset>
                                  </copy>
                                  <copy todir="${dest.profiles}/example/quickstarts/cbr.wiki.profile/data">
                                    <fileset dir="${quickstart.src}/cbr/src/main/resources/data">
                                      <include name="**/*.xml" />
                                    </fileset>
                                  </copy>
                               </target>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>
            <plugin>
                 <groupId>org.fusesource.mvnplugins</groupId>
                 <artifactId>maven-notices-plugin</artifactId>
                 <executions>
                     <execution>
                         <id>merge-notices-in-repository</id>
                         <phase>prepare-package</phase>
                         <goals>
                             <goal>merge-notices-in-repository</goal>
                         </goals>
                         <configuration>
                             <projectName>Fabric8</projectName>
                             <organizationName>Red Hat, Inc. All Rights Reserved.</organizationName>
                             <organizationURL>http://redhat.com</organizationURL>
                             <preamble>In addition to the Red Hat 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 Fabric8. Please see the fabric_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 Red Hat Inc. solely on an "AS IS" basis, without any warranty.  Red Hat, Inc. 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:${xerces.version},xalan:xalan:${xalan.version},xalan:serializer:${xalan.version},org.apache.servicemix.specs:org.apache.servicemix.specs.activator:${servicemix-specs-version},org.apache.servicemix.specs:org.apache.servicemix.specs.jaxp-api-1.4:${servicemix-specs-version},org.apache.servicemix.specs:org.apache.servicemix.specs.jaxws-api-2.2:${servicemix-specs-version}</extraDependencies>
                             <noticeSupplements>classes/notice-supplements.xml</noticeSupplements>
                             <repositories>${project.basedir}/target/features-repo</repositories>
                             <defaultParent>io.fabric8:fabric-project:${project.version}:../..</defaultParent>
                        </configuration>
                     </execution>
                 </executions>
             </plugin>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-assembly-plugin</artifactId>
                   <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>
                   </executions>
               </plugin>
               <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/classes/fabric-features.xml</file>
                                    <type>xml</type>
                                    <classifier>features</classifier>
                                  </artifact>
                                  <artifact>
                                    <file>target/classes/distro/etc/activemq.xml</file>
                                    <type>xml</type>
                                    <classifier>activemq</classifier>
                                  </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-dependency-plugin</artifactId>
                   <executions>
                       <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>
           </plugins>
           <pluginManagement>
           	<plugins>
           		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
           		<plugin>
           			<groupId>org.eclipse.m2e</groupId>
           			<artifactId>lifecycle-mapping</artifactId>
           			<version>1.0.0</version>
           			<configuration>
           				<lifecycleMappingMetadata>
           					<pluginExecutions>
           						<pluginExecution>
           							<pluginExecutionFilter>
           								<groupId>
           									org.apache.karaf.tooling
           								</groupId>
           								<artifactId>
           									features-maven-plugin
           								</artifactId>
           								<versionRange>
           									[2.2.2-fuse-02-06,)
           								</versionRange>
           								<goals>
           									<goal>
           										add-features-to-repo
           									</goal>
           								</goals>
           							</pluginExecutionFilter>
           							<action>
           								<ignore />
           							</action>
           						</pluginExecution>
           					</pluginExecutions>
           				</lifecycleMappingMetadata>
           			</configuration>
           		</plugin>
           	</plugins>
           </pluginManagement>
       </build>

    <repositories>
        <!-- needed for xerces -->
        <repository>
            <id>servicemix.m2-repo</id>
            <name>ServiceMix Maven 2 repository</name>
            <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
        </repository>
    </repositories>
    
    <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <developerUserPassword>admin=admin,admin</developerUserPassword>
            </properties>
        </profile>
    </profiles>
</project>
