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

  <groupId>com.effectiveosgi</groupId>
  <artifactId>eosgi-runtime-parent</artifactId>
  <version>0.0.1</version>
  <name>${project.groupId}:eosgi-runtime</name>
  <url>http://github.com/effectiveosgi/eosgi-runtime</url>
  <description>Effective OSGi Runtime Bundles</description>
  <packaging>pom</packaging>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Neil Bartlett</name>
      <email>nbartlett@fastmail.net</email>
      <organization>Effective OSGi</organization>
      <organizationUrl>https://effectiveosgi.com/</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:effectiveosgi/eosgi-runtime.git</connection>
    <developerConnection>scm:git:git@github.com:effectiveosgi/eosgi-runtime.git</developerConnection>
    <url>http://github.com/effectiveosgi/eosgi-runtime/tree/master</url>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <modules>
    <module>_distro</module>
    <module>_index</module>
    <module>_assembly</module>
    <module>com.effectiveosgi.rt.config</module>
    <module>com.effectiveosgi.rt.config.test</module>
    <module>com.effectiveosgi.rt.aws</module>
    <module>com.effectiveosgi.rt.inspect</module>
  </modules>

  <!-- Declare a profile for CI builds, where indexes are not permitted to
    contain local file: URLs. -->
  <profiles>
    <profile>
      <id>CI_Build</id>
      <properties>
        <local.index.policy>FORBIDDEN</local.index.policy>
      </properties>
    </profile>
  </profiles>

  <properties>
    <local.index.policy>REQUIRED</local.index.policy>
    <bnd.maven.version>3.5.0</bnd.maven.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- PROVIDED -->
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>osgi.core</artifactId>
        <version>6.0.0</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>osgi.cmpn</artifactId>
        <version>6.0.0</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>osgi.annotation</artifactId>
        <version>6.0.1</version>
        <scope>provided</scope>
      </dependency>

      <!-- TEST -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-maven-plugin</artifactId>
          <version>${bnd.maven.version}</version>
          <configuration>
            <bnd><![CDATA[
# Automatically export any package annotated with @Version in its package-info.java
-exportcontents: ${packages;VERSIONED}

# Generate an OSGi Contract Requirement for bundles that depend on the Servlet API
# (see https://www.osgi.org/portable-java-contract-definitions/)
-contract: JavaServlet
  
# Force Declarative Services bundles to declare a requirement for DS version 1.3
# even when they only use features from a previous version
-dsannotations-options: extender, inherit
            ]]>
            </bnd>
          </configuration>
          <executions>
            <execution>
              <id>default-bnd-process</id>
              <goals>
                <goal>bnd-process</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-indexer-maven-plugin</artifactId>
          <version>${bnd.maven.version}</version>
          <configuration>
            <includeJar>true</includeJar>
            <localURLs>${local.index.policy}</localURLs>
          </configuration>
          <executions>
            <execution>
              <id>default-index</id>
              <goals>
                <goal>index</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-export-maven-plugin</artifactId>
          <version>${bnd.maven.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>export</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-testing-maven-plugin</artifactId>
          <version>${bnd.maven.version}</version>
          <configuration>
            <resolve>true</resolve>
            <failOnChanges>true</failOnChanges>
          </configuration>
          <executions>
            <execution>
            <goals>
              <goal>testing</goal>
            </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.6</version>
          <configuration>
            <archive>
              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
          </configuration>
        </plugin>

      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-indexer-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.4</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
            <configuration>
              <keyname>Neil Bartlett [Fastmail]</keyname>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
    </plugins>

  </build>

</project>
