<?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>

    <parent>
        <groupId>org.apache.servicemix</groupId>
        <artifactId>servicemix-pom</artifactId>
        <version>5</version>
        <relativePath>../../servicemix-pom/pom.xml</relativePath>
    </parent>

    <groupId>org.apache.servicemix.bundles</groupId>
    <artifactId>bundles-pom</artifactId>
    <packaging>pom</packaging>
    <version>10</version>
    <name>Apache ServiceMix :: Bundles</name>

    <properties>
        <servicemix.legal.version>1.0</servicemix.legal.version>
        <servicemix.osgi.export>${servicemix.osgi.export.pkg}*;version=${pkgVersion};-split-package:=merge-first
        </servicemix.osgi.export>
        <servicemix.osgi.export.pkg />
        <servicemix.osgi.import.pkg />
        <servicemix.osgi.private.pkg />
        <servicemix.osgi.dynamicimport.pkg />
        <servicemix.osgi.failok>false</servicemix.osgi.failok>
        <servicemix.osgi.embed.dependency />
        <servicemix.osgi.fragment.host />
    </properties>

    <prerequisites>
        <maven>2.2.1</maven>
    </prerequisites>

    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/servicemix/smx4/bundles/tags/bundles-pom-10</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/servicemix/smx4/bundles/tags/bundles-pom-10
        </developerConnection>
        <url>http://svn.apache.org/viewvc/servicemix/smx4/bundles/tags/bundles-pom-10</url>
    </scm>

    <build>
        <defaultGoal>install</defaultGoal>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.2.1</version>
                    <configuration>
                        <useReleaseProfile>false</useReleaseProfile>
                        <preparationGoals>clean install</preparationGoals>
                        <goals>deploy</goals>
                        <arguments>-Prelease</arguments>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <remoteTagging>false</remoteTagging>
                        <!-- avoid remote tagging as it requires an <scm /> section for every bundle -->
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>1.4</version>
                    <executions>
                        <execution>
                            <id>sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <artifactSet>
                                    <includes>
                                        <include>*:*:*:sources</include>
                                        <include>${project.groupId}:${project.artifactId}:*:sources</include>
                                    </includes>
                                </artifactSet>
                                <filters>
                                    <filter>
                                        <artifact>*:*</artifact>
                                        <excludes>
                                            <exclude>**/*.class</exclude>
                                        </excludes>
                                    </filter>
                                </filters>
                                <transformers>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                        <manifestEntries>
                                            <Bundle-SymbolicName>${project.artifactId}.source</Bundle-SymbolicName>
                                            <Eclipse-SourceBundle>${project.artifactId};version="${project.version}"</Eclipse-SourceBundle>
                                        </manifestEntries>
                                    </transformer>
                                </transformers>
                                <promoteTransitiveDependencies>false</promoteTransitiveDependencies>
                                <shadedArtifactAttached>true</shadedArtifactAttached>
                                <shadedClassifierName>sources</shadedClassifierName>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.2</version>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <includePom>true</includePom>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jarsigner-plugin</artifactId>
                    <version>1.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </plugin>
            </plugins>

        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Description>${project.description}</Bundle-Description>
                        <Export-Package>${servicemix.osgi.export}</Export-Package>
                        <Import-Package>${servicemix.osgi.import.pkg}</Import-Package>
                        <Private-Package>${servicemix.osgi.private.pkg}</Private-Package>
                        <DynamicImport-Package>${servicemix.osgi.dynamicimport.pkg}</DynamicImport-Package>
                        <Embed-Dependency>${servicemix.osgi.embed.dependency}</Embed-Dependency>
                        <Bundle-NativeCode>${servicemix.osgi.native}</Bundle-NativeCode>
                        <Bundle-Activator>${servicemix.osgi.activator}</Bundle-Activator>
                        <Fragment-Host>${servicemix.osgi.fragment.host}</Fragment-Host>
                        <_failok>${servicemix.osgi.failok}</_failok>
                        <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
                        <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Embed-Dependency
                        </_removeheaders>
                    </instructions>
                    <unpackBundle>true</unpackBundle>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>copy-legal</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.servicemix.legal</groupId>
                                    <artifactId>legal</artifactId>
                                    <version>${servicemix.legal.version}</version>
                                    <type>xml</type>
                                    <outputDirectory>target/legal/</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.servicemix.legal</groupId>
                        <artifactId>legal</artifactId>
                        <version>${servicemix.legal.version}</version>
                        <type>xml</type>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <resourceBundles>
                                <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
                            </resourceBundles>
                            <supplementalModels>
                                <supplementalModel>target/legal/legal.xml</supplementalModel>
                            </supplementalModels>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.servicemix.bundles</groupId>
                        <artifactId>src-assembly</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>make-src-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>src-assembly</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- We want to deploy the artifact to a staging location for perusal -->
                    <plugin>
                        <inherited>true</inherited>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>2.7</version>
                        <configuration>
                            <updateReleaseInfo>true</updateReleaseInfo>
                        </configuration>
                    </plugin>
                    <!-- We want to sign the artifact, the POM, and all attached artifacts -->
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
