<?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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.smartcosmos</groupId>
        <artifactId>smartcosmos-framework-parent</artifactId>
        <version>3.0.0</version>
        <relativePath></relativePath>
    </parent>

    <artifactId>smartcosmos-edge-things</artifactId>
    <version>3.0.0</version>
    <name>SMART COSMOS Objects Things Edge REST Service</name>
    <description>Things Edge REST Endpoints</description>

    <properties>
        <jackson-datatype-joda.version>2.1.5</jackson-datatype-joda.version>
        <jackson.version>2.4.2</jackson.version>
        <jersey.version>1.18</jersey.version>
        <jodatime.version>2.3</jodatime.version>
        <springfox.version>2.4.0</springfox.version>
        <start-class>net.smartcosmos.edge.things.ThingEdgeService</start-class>
        <swagger-api-docs-asciidoc-directory>${swagger-api-docs-base-directory}/asciidoc</swagger-api-docs-asciidoc-directory>
        <swagger-api-docs-base-directory>${swagger-base-directory}/api-docs</swagger-api-docs-base-directory>
        <swagger-api-docs-html-directory>${swagger-api-docs-base-directory}/html</swagger-api-docs-html-directory>
        <swagger-api-docs-json-directory>${swagger-api-docs-base-directory}/json</swagger-api-docs-json-directory>
        <swagger-api-docs-pdf-directory>${swagger-api-docs-base-directory}/pdf</swagger-api-docs-pdf-directory>
        <!--
          * The generated json file and the adoc files are written by the test that reads the Swagger annotations.
        -->
        <swagger-base-directory>${project.build.directory}/generated</swagger-base-directory>
        <swagger-codegen-base-directory>${swagger-base-directory}/sdk</swagger-codegen-base-directory>
        <swagger-codegen-compile-target>${swagger-codegen-base-directory}/classes</swagger-codegen-compile-target>
        <swagger-codegen-package-base>net.smartcosmos.client.things</swagger-codegen-package-base>
        <swagger-codegen-source>${swagger-codegen-base-directory}</swagger-codegen-source>
        <swagger-codegen.version>2.1.6</swagger-codegen.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
        </dependency>
        <dependency>
            <groupId>net.smartcosmos</groupId>
            <artifactId>smartcosmos-framework</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-oauth2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path-assert</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>1.0.0.Final</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.restassured</groupId>
            <artifactId>spring-mock-mvc</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${springfox.version}</version>
            <scope>test</scope>
        </dependency>
        <?SORTPOM IGNORE?>
        <!-- Added so the generated clients will compile.  When the code-gen works these can probably be removed.-->
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>${jersey.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-multipart</artifactId>
            <version>${jersey.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
            <version>2.1.5</version>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>${jodatime.version}</version>
        </dependency>

        <!-- Base64 encoding that works in both JVM and Android -->
        <dependency>
            <groupId>com.brsanthu</groupId>
            <artifactId>migbase64</artifactId>
            <version>2.2</version>
        </dependency>

        <?SORTPOM RESUME?>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <scm>
        <connection>scm:git:ssh://git@github.com/SMARTRACTECHNOLOGY/smartcosmos-edge-things.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/SMARTRACTECHNOLOGY/smartcosmos-edge-things.git</developerConnection>
        <url>https://github.com/SMARTRACTECHNOLOGY/smartcosmos-edge-things/tree/master/</url>
        <tag>v3.0.0</tag>
    </scm>

    <profiles>
        <profile>
            <id>generate-documentation</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <?SORTPOM IGNORE?>
                    <plugin>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctor-maven-plugin</artifactId>
                        <version>1.5.2</version>

                        <configuration>
                            <sourceDirectory>${swagger-api-docs-asciidoc-directory}</sourceDirectory>
                            <attributes>
                                <generated>${project.build.directory}/docs/asciidoc/generated</generated>
                                <docVersion>${project.version}</docVersion>
                            </attributes>
                        </configuration>

                        <dependencies>
                            <dependency>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctorj-pdf</artifactId>
                                <version>1.5.0-alpha.7</version>
                            </dependency>
                        </dependencies>

                        <executions>
                            <execution>
                                <id>generate-pdf-doc</id>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals>
                                <phase>prepare-package</phase>
                                <configuration>
                                    <backend>pdf</backend>
                                    <doctype>book</doctype>
                                    <outputDirectory>${swagger-api-docs-pdf-directory}</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-html-doc</id>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals>
                                <phase>prepare-package</phase>
                                <configuration>
                                    <backend>html</backend>
                                    <doctype>book</doctype>
                                    <outputDirectory>${swagger-api-docs-html-directory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <?SORTPOM RESUME?>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>generate-sdk</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-sdk</id>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <sources>
                                        <source>${swagger-codegen-source}/src/main/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <?SORTPOM IGNORE?>
                    <plugin>
                        <groupId>io.swagger</groupId>
                        <artifactId>swagger-codegen-maven-plugin</artifactId>
                        <version>${swagger-codegen.version}</version>
                        <executions>
                            <execution>
                                <id>client-sdk-generate</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                                <configuration>
                                    <inputSpec>${swagger-api-docs-json-directory}/swagger.json</inputSpec>
                                    <language>java</language>
                                    <groupId>net.smartcosmos.client</groupId>
                                    <artifactId>smartcosmos-things-java-client</artifactId>
                                    <apiPackage>${swagger-codegen-package-base}.api</apiPackage>
                                    <modelPackage>${swagger-codegen-package-base}.model</modelPackage>
                                    <invokerPackage>${swagger-codegen-package-base}</invokerPackage>
                                    <output>${swagger-codegen-source}</output>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>client-sdk-jar-build</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <skip>true</skip>
                            <executable>mvn</executable>
                            <arguments>
                                <argument>-debug</argument>
                                <argument>package</argument>
                            </arguments>
                            <workingDirectory>${swagger-codegen-base-directory}</workingDirectory>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>client-sdk-package</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classifier>client-sdk</classifier>
                                    <classesDirectory>${swagger-codegen-compile-target}</classesDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <?SORTPOM RESUME?>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
