<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 2011-2013 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
    or packager/legal/LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at packager/legal/LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<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">
    <modelVersion>4.0.0</modelVersion>
    <!-- This parent helps us in release process. Nothing specific to what we do here. -->
    <parent>
        <groupId>net.java</groupId>
        <artifactId>jvnet-parent</artifactId>
        <version>3</version>
    </parent>
    <groupId>org.glassfish.fighterfish</groupId>
    <artifactId>sample.parent-pom</artifactId>
    <version>1.0.2</version>
    <packaging>pom</packaging>
    <name>FighterFish Samples Parent POM</name>
    <description>${project.name}</description>

    <scm>
        <connection>scm:svn:https://svn.java.net/svn/glassfish~svn/tags/fighterfish-releases/sample.parent-pom-1.0.2</connection>
        <developerConnection>scm:svn:https://svn.java.net/svn/glassfish~svn/tags/fighterfish-releases/sample.parent-pom-1.0.2</developerConnection>
        <url>https://svn.java.net/svn/glassfish~svn/tags/fighterfish-releases/sample.parent-pom-1.0.2</url>
    </scm>

    <!-- This POM serves as the parent of all our hybrid application modules.
         We configure common plugins and dependencies here. -->
    <build>
        <finalName>${project.artifactId}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <!-- 2.2.0 and above have new bnd which has wab instruction. 2.3.4 has
                             few important bug fixes. -->
                    <version>2.3.4</version>
                    <extensions>true</extensions>
                    <configuration>
                        <supportedProjectTypes>
                            <supportedProjectType>ejb</supportedProjectType>
                            <supportedProjectType>war</supportedProjectType>
                            <supportedProjectType>bundle</supportedProjectType>
                            <supportedProjectType>jar</supportedProjectType>
                        </supportedProjectTypes>
                        <instructions>
                            <!-- Read all OSGi configuration info from this optional file -->
                            <_include>-osgi.properties</_include>
                            <!-- No packages are exported by default. Having any pattern is dangerous, as the
                                   plugin will add any package found in dependency chain that matches the pattern as well.
                                   Since there is no easy way to have an include filter for just local packages, we don't
                                   export anything by default.-->
                            <Export-Package>!*</Export-Package>
                        </instructions>
                    </configuration>
                    <executions>
                        <execution>
                            <id>bundle-manifest</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>manifest</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>bundle-install</id>
                            <phase>install</phase>
                            <goals>
                                <goal>install</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin> <!-- Need to use this plugin to build war files -->
                    <artifactId>maven-war-plugin</artifactId>
                    <groupId>org.apache.maven.plugins</groupId>
                    <version>2.1</version>
                    <configuration>
                        <archive>
                            <!-- add bundle plugin generated manifest to the war -->
                            <manifestFile>
                                ${project.build.outputDirectory}/META-INF/MANIFEST.MF
                            </manifestFile>
                            <!-- Adding Bundle-ClassPath in maven-bundle-plugin confuses that
                                       plugin and it generates wrong Import-Package, etc. So, we generate it here. -->
                            <manifestEntries>
                                <Bundle-ClassPath>WEB-INF/classes/
                                </Bundle-ClassPath>
                            </manifestEntries>
                        </archive>
                        <!-- We don't always have a web.xml -->
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <!-- add bundle plugin generated manifest to the jar -->
                            <manifestFile>
                                ${project.build.outputDirectory}/META-INF/MANIFEST.MF
                            </manifestFile>
                        </archive>
                    </configuration>
                </plugin>
                <plugin> <!-- Need to use this plugin to build ejb-jar files -->
                    <artifactId>maven-ejb-plugin</artifactId>
                    <groupId>org.apache.maven.plugins</groupId>
                    <version>2.3</version>
                    <configuration>
                        <ejbVersion>3.1</ejbVersion>
                        <archive>
                            <!-- add bundle plugin generated manifest to the war -->
                            <manifestFile>
                                ${project.build.outputDirectory}/META-INF/MANIFEST.MF
                            </manifestFile>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.13</version>
                    <configuration>
                        <!--
                        Maven chooses to make provided dependencies part of test classpath.
                        The javaee-api and javaee-web-api jars can't be used in runtime, for they
                        don't contain proper classes, so we exclude them from test classpath.
                        -->
                        <classpathDependencyExcludes>
                            <classpathDependencyExclude>javax:javaee-api</classpathDependencyExclude>
                            <classpathDependencyExclude>javax:javaee-web-api</classpathDependencyExclude>
                        </classpathDependencyExcludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.12.2</version>
                    <configuration>
                        <!--
                        Maven chooses to make provided dependencies part of test classpath.
                        The javaee-api and javaee-web-api jars can't be used in runtime, for they
                        don't contain proper classes, so we exclude them from test classpath.
                        -->
                        <classpathDependencyExcludes>
                            <classpathDependencyExclude>javax:javaee-api</classpathDependencyExclude>
                            <classpathDependencyExclude>javax:javaee-web-api</classpathDependencyExclude>
                        </classpathDependencyExcludes>
                    </configuration>
                </plugin>
                <!--
                The following plugin is used during release.
                The profile jvnet-release is what is mentioned in parent pom. 
                gpg plugin is enabled in that profile.
                Pass gpg passphrase so that release can happen in non-interactive mode.
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <configuration>
                        <arguments>-Pjvnet-release -Dgpg.passphrase=${gpg.passphrase}</arguments>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <!-- Enable this plugin for all modules -->
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.core</artifactId>
                <version>4.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.compendium</artifactId>
                <version>4.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>3.8.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-web-api</artifactId>
                <version>6.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>6.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish.fighterfish</groupId>
                <artifactId>osgi-cdi-api</artifactId>
                <version>1.0.0</version>
                <type>jar</type>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <!-- Add the the following dependencies to every module to save user from
              adding them to every one. -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.fighterfish</groupId>
            <artifactId>osgi-cdi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
        </dependency>
    </dependencies>
</project>
