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

  <name>kheos service</name>

  <parent>
    <groupId>io.honnix</groupId>
    <artifactId>kheos</artifactId>
    <version>0.0.3</version>
  </parent>

  <artifactId>kheos-service</artifactId>
  <packaging>jar</packaging>

  <properties>
    <service.main>io.honnix.kheos.service.ServiceKt</service.main>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.honnix</groupId>
      <artifactId>kheos-lib</artifactId>
    </dependency>
    <dependency>
      <groupId>com.spotify</groupId>
      <artifactId>apollo-http-service</artifactId>
    </dependency>
    <dependency>
      <groupId>com.spotify</groupId>
      <artifactId>apollo-entity</artifactId>
    </dependency>
    <dependency>
      <groupId>com.squareup.okio</groupId>
      <artifactId>okio</artifactId>
    </dependency>
    <dependency>
      <groupId>com.spotify</groupId>
      <artifactId>apollo-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
    </dependency>
  </dependencies>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <useBaseVersion>false</useBaseVersion>
          <overWriteReleases>false</overWriteReleases>
          <overWriteSnapshots>true</overWriteSnapshots>
          <includeScope>runtime</includeScope>
          <outputDirectory>${project.build.directory}/lib</outputDirectory>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>create-timestamp</id>
            <phase>validate</phase>
            <goals>
              <goal>create-timestamp</goal>
            </goals>
            <configuration>
              <timezone>UTC</timezone>
              <timestampFormat>yyyyMMdd'T'HHmmss</timestampFormat>
              <timestampPropertyName>buildTimestamp</timestampPropertyName>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <addMavenDescriptor>true</addMavenDescriptor>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              <addClasspath>true</addClasspath>
              <classpathPrefix>lib/</classpathPrefix>
              <mainClass>${service.main}</mainClass>
            </manifest>
            <manifestEntries>
              <Implementation-Version>${project.version}-${buildTimestamp}-${buildNumber}</Implementation-Version>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>dockerfile-maven-plugin</artifactId>
        <configuration>
          <repository>docker.io/honnix/${project.artifactId}</repository>
          <tag>${project.version}-${buildTimestamp}-${buildNumber}</tag>
          <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
