<?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/xsd/maven-4.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.karaf</groupId>
        <artifactId>karaf</artifactId>
        <version>4.4.10</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>org.apache.karaf.main</artifactId>
    <packaging>bundle</packaging>
    <name>Apache Karaf :: Main</name>
    <description>This bundle is the main Karaf launcher. It's responsible of the Karaf startup including
    the console, branding, etc bootstrap.</description>

    <properties>
        <appendedResourcesDirectory>${basedir}/../etc/appended-resources</appendedResourcesDirectory>
        <!-- it can be removed after the tinybundle 4 update -->
        <javaVersion>8</javaVersion>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.karaf</groupId>
                <artifactId>karaf-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.framework</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.karaf</groupId>
            <artifactId>org.apache.karaf.util</artifactId>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.tinybundles</groupId>
            <artifactId>tinybundles</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>5.6.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.blueprint</groupId>
            <artifactId>org.apache.aries.blueprint.api</artifactId>
            <version>1.0.1</version>
            <scope>test</scope>
        </dependency>
        <!-- karaf framework 1.0.0 features xml -->
        <!-- pax-url-mvn.jar -->
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>org.apache.aries.blueprint</groupId>
                            <artifactId>org.apache.aries.blueprint.api</artifactId>
                            <version>1.0.0</version>
                            <outputDirectory>${project.build.testOutputDirectory}/test-karaf-home/system/org/apache/aries/blueprint/org.apache.aries.blueprint.api/1.0.0</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                            <groupId>org.ops4j.pax.url</groupId>
                            <artifactId>pax-url-mvn</artifactId>
                            <version>1.3.7</version>
                            <outputDirectory>${project.build.testOutputDirectory}/test-karaf-home/system/</outputDirectory>
                            <destFileName>pax-url-mvn.jar</destFileName>
                        </artifactItem>
                        <artifactItem>
                            <groupId>org.apache.felix</groupId>
                            <artifactId>org.apache.felix.framework</artifactId>
                            <version>5.6.10</version>
                            <outputDirectory>${project.build.testOutputDirectory}/test-karaf-home/system/org/apache/felix/org.apache.felix.framework/5.6.10</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                    <excludeTransitive>true</excludeTransitive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <_donotcopy>(CVS|.svn|config.properties)</_donotcopy>
                        <Main-Class>org.apache.karaf.main.Main</Main-Class>
                        <Bundle-Name>Apache Karaf</Bundle-Name>
                        <Bundle-Description>OSGi R4 framework.</Bundle-Description>
                        <Export-Package>
                            org.apache.karaf.info
                        </Export-Package>
                        <Private-Package>
                            org.apache.karaf.main*,
                            org.apache.karaf.jpm*,
                            org.apache.felix.utils.properties;-split-package:=merge-first,
                            org.apache.karaf.util.config,
                            org.apache.karaf.util.maven,
                            org.apache.karaf.util.locks;-split-package:=merge-first,
                            META-INF;-split-package:=merge-first
                        </Private-Package>
                        <Import-Package>!*</Import-Package>
                    </instructions>
                    <unpackBundle>true</unpackBundle>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>deploy</id>
            <properties>
                <createSourcesJar>true</createSourcesJar>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>package</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <minmemory>128m</minmemory>
                            <maxmemory>512m</maxmemory>
                            <sourcepath>${project.build.directory}/sources</sourcepath>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
