<?xml version="1.0" encoding="UTF-8"?>
<!--
  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.
-->
<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.apache.activemq</groupId>
    <artifactId>activemq-parent</artifactId>
    <version>5.17.4</version>
  </parent>

  <artifactId>activemq-osgi</artifactId>
  <packaging>bundle</packaging>
  <name>ActiveMQ :: OSGi bundle</name>
  <description>Puts together an ActiveMQ OSGi bundle</description>

  <properties>
    <surefire.argLine>-Xmx512M</surefire.argLine>
  </properties>

  <dependencies>
    <!-- The core broker dependency -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-broker</artifactId>
    </dependency>

    <!-- Additional message store impls -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-kahadb-store</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-jdbc-store</artifactId>
    </dependency>

    <!-- Additional protocol impls -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-stomp</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-amqp</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-mqtt</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-http</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-partition</artifactId>
    </dependency>

    <!-- Additional Dependencies. -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-jaas</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-console</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-ra</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-web</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-spring</artifactId>
    </dependency>
    
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-blueprint</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>activemq-runtime-config</artifactId>
    </dependency>

    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.cmpn</artifactId>
       <scope>provided</scope>
    </dependency>

  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>target/extra-resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
          <compilerArgument>-proc:none</compilerArgument>
	</configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <inherited>true</inherited>
        <configuration>
          <instructions>
            <Bundle-Activator>org.apache.activemq.util.osgi.Activator</Bundle-Activator>
            <Embed-Dependency>
              *;groupId=org.apache.activemq;inline=META-INF/services/*,
              *;groupId=org.apache.qpid;inline=META-INF/services/*,
              *;groupId=org.apache.xbean;inline=true
            </Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Export-Package>
              org.apache.activemq*;version=${project.version};-noimport:=true;-split-package:=merge-first,
              org.apache.activemq.web*;version=${project.version};-noimport:=true;-split-package:=merge-first
            </Export-Package>
            <Import-Package>
              !org.apache.commons.daemon,
              !org.apache.maven*,
              !com.google.thirdparty.publicsuffix,
              !com.rometools*,
              !com.google.errorprone.annotations,
              !com.google.errorprone.annotations.concurrent,
              !com.google.j2objc.annotations,
              sun.misc*;resolution:=optional,
              sun.nio*;resolution:=optional,
              sun.rmi*;resolution:=optional,
              javax.xml.bind*;version="[2,3)",
              javax.jmdns*;resolution:=optional,
              javax.resource*;resolution:=optional,
              javax.servlet*;resolution:=optional,
              com.thoughtworks.xstream*;resolution:=optional,
              org.apache.activeio*;resolution:=optional,
              org.apache.camel*;version="${camel-version-range}";resolution:=optional,
              org.apache.camel.spring.handler;version="${camel-version-range}";resolution:=optional,
              org.apache.camel.spring.xml.handler;version="${camel-version-range}";resolution:=optional,
              org.apache.derby.jdbc*;resolution:=optional,
              org.apache.geronimo.transaction.manager*;resolution:=optional,
              org.apache.hadoop*;resolution:=optional,
              org.apache.http*;resolution:=optional,
              org.apache.xpath*;resolution:=optional,
              org.bouncycastle*;resolution:=optional,
              com.fasterxml.jackson*;resolution:=optional,
              org.codehaus.jettison*;resolution:=optional,
              org.jasypt*;resolution:=optional,
              org.eclipse.jetty*;resolution:=optional;version="[9.0,10)",
              org.apache.zookeeper*;resolution:=optional,
              org.fusesource.hawtjni*;resolution:=optional,
              org.springframework.jms*;version="[4,6)";resolution:=optional,
              org.springframework.transaction*;version="[4,6)";resolution:=optional,
              org.springframework*;version="[4,6)";resolution:=optional,
              org.xmlpull*;resolution:=optional,
              !javax.annotation.meta,
              javax.annotation*;version="[1,4)",
              !com.thoughtworks.qdox*,
              org.apache.commons.logging;version="[1.2,2)";resolution:=optional,
              javax.jms*;version="[1.1,3)",
              javax.management*;resolution:=optional,
              javax.transaction*;version="[1,3)",
              javax.naming*;resolution:=optional,
              org.apache.commons.io*;resolution:=optional,
              org.apache.commons.pool*;resolution:=optional,
              org.apache.commons.net*;resolution:=optional,
              com.sun*;resolution:=optional,
              org.jvnet.jaxb2_commons*;resolution:=optional,
              org.xerial.snappy*;resolution:=optional,
              groovy.*;resolution:=optional,
              org.codehaus.groovy*;resolution:=optional,
              org.apache.tools.ant*;resolution:=optional,
              org.apache.log4j*;resolution:=optional,
              org.json*;resolution:=optional,
              org.objectweb.asm;version="[5,10)";resolution:=optional,
              mx4j.tools*;resolution:=optional,
              org.slf4j*;resolution:=optional,
              org.osgi.service.blueprint;resolution:=optional,
              *
            </Import-Package>
            <Private-Package>
              org.apache.xbean*,
              org.fusesource.hawtdispatch*,
              org.fusesource.mqtt*,
              org.fusesource.hawtbuf*,
              org.apache.qpid*,
              com.google.common*,
              com.google.errorprone.annotations,
              com.google.errorprone.annotations.concurrent,
              com.google.j2objc.annotations,
              org.linkedin*,
              org.iq80*
            </Private-Package>
            <DynamicImport-Package>
              *
            </DynamicImport-Package>
            <_noee>true</_noee>
            <_contract>!*</_contract>
          </instructions>
        </configuration>
      </plugin>
      <!-- get camel core spring schema info -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.camel</groupId>
                  <artifactId>camel-spring</artifactId>
                  <version>${camel-version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${basedir}/target/extra-resources/</outputDirectory>
                  <includes>camel-spring.xsd</includes>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.camel</groupId>
                  <artifactId>camel-blueprint</artifactId>
                  <version>${camel-version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${basedir}/target/extra-resources/</outputDirectory>
                  <includes>camel-blueprint.xsd</includes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Copy all necessary resources from other modules, like spring schema mapping, xbean resources, etc. -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-xbean</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/extra-resources/</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/../activemq-spring/target/classes/</directory>
                  <includes>
                    <include>activemq.xsd*</include>
                  </includes>
                </resource>
              </resources>
            </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.maven.plugins
    								</groupId>
    								<artifactId>
    									maven-dependency-plugin
    								</artifactId>
    								<versionRange>[2.8,)</versionRange>
    								<goals>
    									<goal>unpack</goal>
    								</goals>
    							</pluginExecutionFilter>
    							<action>
    								<ignore />
    							</action>
    						</pluginExecution>
    					</pluginExecutions>
    				</lifecycleMappingMetadata>
    			</configuration>
    		</plugin>
    	</plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>deploy</id>
      <build>
        <defaultGoal>deploy</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin-version}</version>
            <configuration>
              <attach>false</attach>
            </configuration>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>apache-release</id>

      <dependencies>

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-client</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-openwire-legacy</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-jaas</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-broker</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-console</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-spring</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-amqp</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-http</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-mqtt</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-stomp</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-kahadb-store</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>activemq-jdbc-store</artifactId>
          <version>${project.version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq.protobuf</groupId>
          <artifactId>activemq-protobuf</artifactId>
          <version>${activemq-protobuf-version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.fusesource.hawtbuf</groupId>
          <artifactId>hawtbuf</artifactId>
          <version>${hawtbuf-version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.jasypt</groupId>
          <artifactId>jasypt</artifactId>
          <version>${jasypt-version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_1.1_spec</artifactId>
          <version>1.1.1</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <!-- <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jta_1.1_spec</artifactId>
          <version>1.1.1</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency> -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
          <version>1.0.1</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-annotation_1.3_spec</artifactId>
          <version>1.0</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>${slf4j-version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-slf4j-impl</artifactId>
          <version>${log4j-version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-core</artifactId>
          <version>${log4j-version}</version>
          <classifier>sources</classifier>
          <optional>true</optional>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <configuration>
              <skipSource>true</skipSource>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>uber-sources-jar</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>${basedir}/src/main/descriptors/uber-sources.xml</descriptor>
                  </descriptors>
                  <appendAssemblyId>true</appendAssemblyId>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>
