<?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.github.czgov</groupId>
  <artifactId>camel-isds</artifactId>
  <packaging>bundle</packaging>
  <version>0.2.0</version>

  <name>Camel :: ISDS</name>
  <description>Camel ISDS Component</description>
  <url>https://github.com/czgov/camel-isds</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <maven.bundle.plugin.version>3.2.0</maven.bundle.plugin.version>
    <maven.source.plugin.version>3.0.1</maven.source.plugin.version>
    <maven.resources.plugin.version>3.0.2</maven.resources.plugin.version>
    <maven.javadoc.plugin.version>2.10.4</maven.javadoc.plugin.version>
    <build.helper.plugin.version>3.0.0</build.helper.plugin.version>

    <camel.version>2.17.3</camel.version>
    <sl4j.version>1.7.21</sl4j.version>
    <log4j.version>1.2.17</log4j.version>

    <java.isds.version>1.1.0</java.isds.version>
  </properties>

  <scm>
    <url>https://github.com/czgov/camel-isds</url>
    <connection>scm:git:https://github.com/czgov/camel-isds.git</connection>
    <developerConnection>scm:git:https://github.com/czgov/camel-isds.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Josef Ludvicek</name>
      <email>josef.ludvicek.cz@gmail.com</email>
    </developer>
  </developers>

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

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>${camel.version}</version>
    </dependency>

    <!-- support camel documentation -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>apt</artifactId>
      <version>${camel.version}</version>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${sl4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${sl4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>cz.abclinuxu.datoveschranky</groupId>
      <artifactId>isds</artifactId>
      <version>${java.isds.version}</version>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test</artifactId>
      <version>${camel.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>install</defaultGoal>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${maven.resources.plugin.version}</version>
        <executions>
          <execution>
            <id>copy-features</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>target/features</outputDirectory>
              <resources>
                <resource>
                  <!-- need to use maven property placeholders in features.xml -->
                  <directory>src/main/features</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!-- tell maven to deploy also features.xml -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${build.helper.plugin.version}</version>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>target/features/features.xml</file>
                  <type>xml</type>
                  <classifier>features</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- generate components meta-data and validate component includes documentation etc -->
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-package-maven-plugin</artifactId>
        <version>2.17.2</version>
        <executions>
          <execution>
            <id>prepare</id>
            <goals>
              <goal>prepare-components</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>
          <execution>
            <id>validate</id>
            <goals>
              <goal>validate-components</goal>
            </goals>
            <phase>prepare-package</phase>
          </execution>
        </executions>
      </plugin>

      <!-- to generate the MANIFEST-FILE of the bundle -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${maven.bundle.plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Import-Packate>org.bouncycastle.cms,*</Import-Packate>
            <Bundle-SymbolicName>${project.groupId}.${project.groupId}</Bundle-SymbolicName>
            <Export-Service>org.apache.camel.spi.ComponentResolver;component=isds</Export-Service>
          </instructions>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!-- sign artifacts when releasing -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
