<?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">
<!--
  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>
  <groupId>org.apache.cxf.dosgi</groupId>
  <artifactId>cxf-dosgi-ri-singlebundle-distribution</artifactId>
  <version>1.1</version>
  <packaging>bundle</packaging>
  <name>Distributed OSGI Single-Bundle Distribution</name>
  <url>http://cxf.apache.org</url>

  <parent>
    <groupId>org.apache.cxf.dosgi</groupId>
    <artifactId>cxf-dosgi-ri-distribution-parent</artifactId>
    <version>1.1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <properties>
    <topDirectoryLocation>../..</topDirectoryLocation>
  </properties>
  
  <dependencies>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-annotation_1.0_spec</artifactId>
      <version>1.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-activation_1.1_spec</artifactId>
      <version>1.0.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-javamail_1.4_spec</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>com.springsource.org.apache.commons.logging</artifactId>
      <version>1.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.jdom</groupId>
      <artifactId>com.springsource.org.jdom</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.aopalliance</groupId>
      <artifactId>com.springsource.org.aopalliance</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.osgi</groupId>
      <artifactId>spring-osgi-io</artifactId>
      <version>${spring.osgi.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.osgi</groupId>
      <artifactId>spring-osgi-core</artifactId>
      <version>${spring.osgi.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.osgi</groupId>
      <artifactId>spring-osgi-extender</artifactId>
      <version>${spring.osgi.version}</version>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.web</groupId>
      <artifactId>pax-web-service</artifactId>
      <version>0.5.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.specs</groupId>
      <artifactId>org.apache.servicemix.specs.saaj-api-1.3</artifactId>
      <version>${servicemix.specs.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.specs</groupId>
      <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
      <version>${servicemix.specs.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.specs</groupId>
      <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
      <version>${servicemix.specs.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.specs</groupId>
      <artifactId>org.apache.servicemix.specs.jaxws-api-2.1</artifactId>
      <version>${servicemix.specs.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.specs</groupId>
      <artifactId>org.apache.servicemix.specs.jsr311-api-1.0</artifactId>
      <version>${servicemix.specs.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.bundles</groupId> 
      <artifactId>org.apache.servicemix.bundles.xmlschema</artifactId> 
      <version>${xmlschema.bundle.version}</version> 
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.bundles</groupId> 
      <artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId> 
      <version>${xmlresolver.bundle.version}</version> 
    </dependency>
    <dependency>
       <groupId>org.apache.servicemix.bundles</groupId> 
       <artifactId>org.apache.servicemix.bundles.neethi</artifactId> 
       <version>${neethi.bundle.version}</version> 
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix.bundles</groupId> 
      <artifactId>org.apache.servicemix.bundles.wsdl4j</artifactId> 
      <version>${wsdl4j.bundle.version}</version>
    </dependency>
    <dependency>
       <groupId>org.apache.servicemix.bundles</groupId> 
       <artifactId>org.apache.servicemix.bundles.xmlsec</artifactId> 
       <version>${xmlsec.bundle.version}</version>
    </dependency>  
    <dependency>
       <groupId>org.apache.servicemix.bundles</groupId> 
       <artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId> 
       <version>${jaxbimpl.bundle.version}</version> 
    </dependency> 

    <dependency>
       <groupId>org.apache.servicemix.bundles</groupId> 
       <artifactId>org.apache.servicemix.bundles.asm</artifactId> 
       <version>${asm.bundle.version}</version> 
    </dependency>
            
    <dependency>
       <groupId>org.apache.servicemix.bundles</groupId> 
       <artifactId>org.apache.servicemix.bundles.woodstox</artifactId> 
       <version>${woodstox.bundle.version}</version> 
    </dependency>

    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.configadmin</artifactId>
      <version>1.0.10</version>
    </dependency>      
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.fileinstall</artifactId>
      <version>1.0.0</version>
    </dependency>      

    <dependency> 
      <groupId>org.apache.log4j</groupId> 
      <artifactId>com.springsource.org.apache.log4j</artifactId> 
      <version>${log4j.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-bundle-minimal</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf.dosgi</groupId>
      <artifactId>cxf-dosgi-ri-discovery-local</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf.dosgi</groupId>
      <artifactId>cxf-dosgi-ri-dsw-cxf</artifactId>
      <version>${project.version}</version>
    </dependency>
   
    <dependency>
      <groupId>org.apache.cxf.dosgi</groupId>
      <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-wrapper</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf.dosgi</groupId>
      <artifactId>cxf-dosgi-ri-discovery-distributed</artifactId>
      <version>${project.version}</version>
    </dependency>
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>  
    <dependency>
      <groupId>org.easymock</groupId>
      <artifactId>easymock</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>        

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Bundle-Name>Distributed OSGi Distribution Software Single-Bundle Distribution</Bundle-Name>
            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
            <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
            <Bundle-Activator>org.apache.cxf.dosgi.singlebundle.AggregatedActivator</Bundle-Activator>
            <Include-Resource>
              @cxf-bundle-minimal-${cxf.version}.jar!/META-INF/spring.*,
              @cxf-bundle-minimal-${cxf.version}.jar!/META-INF/cxf/*,
              {maven-resources}
            </Include-Resource>
            <Import-Package>
              javax.servlet.*;version="[2.3.0,2.6.0)",
              org.osgi.*
            </Import-Package>
            <Export-Package>
              '=META-INF.cxf',
              org.apache.cxf.dosgi.singlebundle;version="${pom.version}"
            </Export-Package>
            <Embed-Dependency>*;scope=compile;inline=false</Embed-Dependency>
            <Embed-Directory>lib</Embed-Directory>
            <_exportcontents>
              javax.xml.ws.*;version="2.1.0",
              javax.ws.rs.*;version="1.0.0", 
              javax.jws.*;version="2.0.0", 
              javax.xml.bind.annotation.*;version="2.1",
              javax.servlet.*;version="2.5.0",
              org.apache.cxf.dosgi.*;version="${pom.version}",
              org.apache.cxf.*;version="${cxf.version}",
              org.jdom.*;version="1.0.0",
              org.osgi.service.cm;version="1.2",
              org.osgi.service.distribution;version="1.0.0",
              org.osgi.service.discovery;version="1.0.0",
              !*
            </_exportcontents> 
            <DynamicImport-Package>*</DynamicImport-Package>
            <_failok>true</_failok>
            <_removeheaders>
              Ignore-Package,
              Include-Resource,
              Private-Package,
              Embed-Dependency
            </_removeheaders>
          </instructions>
        </configuration>
      </plugin> 

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy</id>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.felix</groupId>
                  <artifactId>org.osgi.compendium</artifactId>
                  <version>1.2.0</version>
                  <type>jar</type>
                  <outputDirectory>target/deps</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <configuration>
              <tasks>
                <!-- removing this directory as it confuses Eclipse when importing the bundle as a plugin -->
                <delete dir="target/classes" />

                <fileset dir="target" id="single.bundle">
                  <include name="*.jar" />
                </fileset>
                <pathconvert pathsep="" property="bundle" refid="single.bundle" />

                <fileset dir="target/deps" id="felix.dep.bundles">
                  <include name="*.jar" />
                </fileset>
                <pathconvert pathsep=" file:/" property="felix.deps" refid="felix.dep.bundles" />

                <!-- config.properties file for Felix -->
                <echo file="target/felix.config.properties.append">
org.ops4j.pax.web.session.timeout=30
org.osgi.framework.startlevel=2
felix.auto.start.2=
                </echo>
                <echo message="file:/${felix.deps} file:/${bundle}" file="target/felix.config.properties.append" append="true" />
                <replace file="target/felix.config.properties.append" token="\" value="/" />

                <!-- config.ini file for Equinox -->
                <echo file="target/equinox.config.ini.append">
org.ops4j.pax.web.session.timeout=30

osgi.bundles=org.eclipse.osgi.services@start, 
                </echo>
                <echo message="${bundle}@start" file="target/equinox.config.ini.append" append="true" />
                <replace file="target/equinox.config.ini.append" token="\" value="/" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
