<?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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.roo</groupId>
        <artifactId>org.springframework.roo.runtime</artifactId>
        <version>2.0.0.RC1</version>
        <relativePath>../../runtime</relativePath>
    </parent>

    <!-- MODULE USAGE:
    This module simply provides POM configuration inheritence for those
    modules that build OSGi bundles, such as roo addons, runtime bundles, etc. 
    This module does not contain any reactor build.
    -->

    <artifactId>org.springframework.roo.osgi.bundle</artifactId>
    <packaging>pom</packaging>
    <name>Spring Roo - Runtime - OSGi Bundle Module Parent</name>
    <description>Provides POM configuration inheritence for those modules that build an OSGi bundle.</description>

    <properties>
        <target.jar.directory>${project.build.directory}/../../target/all</target.jar.directory>
    </properties>

    <!-- No modules should be defined below -->
    <modules />

    <build>
        <plugins>
            <plugin>
                <!-- Generate ... TBC -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>git</executable>
                    <arguments>
                        <argument>log</argument>
                        <argument>--pretty=format:Git-Commit-Hash: %H</argument>
                        <argument>-n1</argument>
                    </arguments>
                    <outputFile>${project.build.directory}/build-number.mf</outputFile>
                    <successCodes>
                        <!-- Skip failures due to missing Git or the project not 
                            being a Git repo (needed for add-ons which ultimately extend this POM but don't use 
                            Git) -->
                        <successCode>0</successCode>
                        <successCode>1</successCode>
                        <successCode>127</successCode>
                        <successCode>128</successCode>
                    </successCodes>
                </configuration>
            </plugin>
            <plugin>
                <!--
                OSGi forces to provide additional metadata in the JAR's 
                MANIFEST to verify the consistency of your "class path".
                This plugin create the MANIFEST from the classes and project 
                properties instead of maintaining it by hand.
                -->
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.4</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <!-- 
                        bnd 2.3 automatically adds a Require-Capability
                        for Java execution environment version, _noee=true 
                        disables it.
                        -->
                        <_noee>true</_noee>
                        <_include>${project.build.directory}/build-number.mf</_include>
                        <Export-Package>${project.artifactId}.*;version=${project.version}</Export-Package>
                        <Bundle-Activator>${bundle.activator}</Bundle-Activator>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                        <Bundle-Copyright>Copyright ${project.organization.name}. All Rights Reserved.</Bundle-Copyright>
                        <Bundle-DocURL>${project.url}</Bundle-DocURL>
                    </instructions>
                </configuration>
            </plugin>
                <plugin>
                    <!-- 
                    Copy the OSGi bundles that the modules have built locally and  
                    that noone else depends on into the ROO_PRJ_HOME/target/all
                    -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                </plugin>
            <plugin>
                <!-- 
                OSGi components and services are defined through annotations 
                and this plugin creates the necessary descriptors for the 
                OSGi Declarative Services, Config Admin and Metatype services.
                -->
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
                <version>1.21.0</version>
                <executions>
                    <execution>
                        <id>generate-scr-scrdescriptor</id>
                        <goals>
                            <goal>scr</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <parseJavaDoc>false</parseJavaDoc>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <!-- 
            Some Maven plugins are recognized as problematic by Eclipse m2e 
            and will produce error markers with a text similar to:
 
            maven-dependency-plugin (goals "copy-dependencies","unpack") is 
            not supported by m2e. In version 1.0 there is no quick fix 
            available for this but it is possible to define a lifecycle 
            mapping for the plugin which removes the error marker 
            http://wiki.eclipse.org/M2E_plugin_execution_not_covered#Common_problems 
            
            To configure your Eclipse to use the lifecycle mapping in this file
            read http://wiki.eclipse.org/M2E_plugin_execution_not_covered#Eclipse_4.2_add_default_mapping 
            -->
            <plugins>
                <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>
                                        <goals>
                                            <goal>copy-dependencies</goal>
                                            <goal>unpack</goal>
                                        </goals>
                                        <versionRange>[0.0,)</versionRange>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>exec-maven-plugin</artifactId>
                                        <goals>
                                            <goal>exec</goal>
                                        </goals>
                                        <versionRange>[0.0,)</versionRange>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
