<?xml version="1.0"?>
<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
 Copyright (c) 2014-2017 Cisco Systems, Inc. and others.  All rights reserved.

 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0 which accompanies this distribution,
 and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<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>
    <parent>
        <groupId>org.opendaylight.odlparent</groupId>
        <artifactId>karaf4-parent</artifactId>
        <version>9.0.13</version>
        <relativePath/>
    </parent>
    <groupId>org.opendaylight.integration</groupId>
    <artifactId>karaf</artifactId>
    <version>0.15.2</version>
    <packaging>pom</packaging>
    <!-- <name> formatting is used by autorelease to parse and notify projects on
         build failure. Please do not modify this unless you have a good reason. -->
    <name>ODL :: integration :: ${project.artifactId}</name>
    <description>The actual Karaf archive building sub-project.</description>
    <url>https://wiki.opendaylight.org/x/ggYF</url>
    <licenses>
        <license>
            <name>Eclipse Public License v1.0</name>
            <url>http://www.eclipse.org/legal/epl-v10.html</url>
        </license>
    </licenses>
    <!-- FIXME: Add developers section -->
    <scm>
        <connection>scm:git:https://git.opendaylight.org/gerrit/integration/distribution.git</connection>
        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/integration/distribution.git</developerConnection>
        <url>https://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=tree;f=karaf;hb=HEAD</url>
        <tag>HEAD</tag>
    </scm>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.opendaylight.integration</groupId>
                <artifactId>all-artifacts</artifactId>
                <version>0.15.2</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <!-- Integration index feature repository. -->
        <dependency>
            <groupId>org.opendaylight.integration</groupId>
            <artifactId>features-index</artifactId>
            <classifier>features</classifier>
            <type>xml</type>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.opendaylight.odlparent</groupId>
                    <artifactId>opendaylight-karaf4-empty</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.opendaylight.odlparent</groupId>
                    <artifactId>opendaylight-karaf-empty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Integration test feature repository. -->
        <dependency>
            <groupId>org.opendaylight.integration</groupId>
            <artifactId>features-test</artifactId>
            <classifier>features</classifier>
            <type>xml</type>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.opendaylight.odlparent</groupId>
                    <artifactId>opendaylight-karaf4-empty</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.opendaylight.odlparent</groupId>
                    <artifactId>opendaylight-karaf-empty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- This scope test here is just a trick, so that we can use the dependencies
         in maven-dependency-plugin, but don't have karaf-maven-plugin choke on it -->
        <dependency>
            <groupId>org.opendaylight.aaa</groupId>
            <artifactId>aaa-cli-jar</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.opendaylight.integration</groupId>
            <artifactId>karaf-scripts</artifactId>
            <version>0.15.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-aaa-cli-jar</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/assembly/bin</outputDirectory>
                            <includeArtifactIds>aaa-cli-jar</includeArtifactIds>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                            <excludeTransitive>true</excludeTransitive>
                            <!-- Do not include version in JAR filename, as external scripts call this utility,
                                 and they understandly do not want to have to adjust for every ODL release;
                                 see e.g. https://github.com/dfarrell07/puppet-opendaylight/pull/140 -->
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-odl-karaf-resources</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <configuration>
                            <outputDirectory>${project.build.directory}/assembly</outputDirectory>
                            <groupId>org.opendaylight.integration</groupId>
                            <includeArtifactIds>karaf-scripts</includeArtifactIds>
                            <excludes>META-INF\/**</excludes>
                            <excludeTransitive>true</excludeTransitive>
                            <ignorePermissions>false</ignorePermissions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dependency-convergence</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-dependency-convergence</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <dependencyConvergence/>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
