<?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">
    <parent>
        <artifactId>smsc</artifactId>
        <groupId>io.smsc</groupId>
        <version>0.0.2</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>core</artifactId>
    <packaging>jar</packaging>
    <version>0.0.2</version>

    <properties>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy-MM-dd-HH:mm</maven.build.timestamp.format>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.smsc</groupId>
            <artifactId>admin</artifactId>
            <version>0.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
        </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-data</artifactId>
            </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-hal-browser</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-hateoas</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.restdocs</groupId>
            <artifactId>spring-restdocs-mockmvc</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jsmpp</groupId>
            <artifactId>jsmpp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.directory.studio</groupId>
            <artifactId>org.apache.commons.io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
        </dependency>

        <!-- Encoding -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <!-- Security -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
        </dependency>

        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
        </dependency>
    </dependencies>

    <build>
        <finalName>smsc</finalName>
        <plugins>
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.12</version>
                <executions>
                    <execution>
                        <id>reserve-tomcat-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>process-resources</phase>
                        <configuration>
                            <portNames>
                                <portName>tomcat.http.port</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <test.server.port>${tomcat.http.port}</test.server.port>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>io.smsc.Application</mainClass>
                    <layout>ZIP</layout>
                    <addResources>false</addResources>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>pre-integration-test</id>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <arguments>
                                <argument>--server.port=${tomcat.http.port}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <configuration>
                    <imageName>smscio/smsc</imageName>
                    <baseImage>java:8-alpine</baseImage>
                    <entryPoint>
                        ["java", "-jar", "/app/${project.build.finalName}.jar"]
                    </entryPoint>
                    <exposes>
                        <expose>8080</expose>
                        <expose>2775</expose>
                    </exposes>
                    <!--<volumes>-->
                    <!--<volume>/app</volume>-->
                    <!--</volumes>-->
                    <resources>
                        <resource>
                            <targetPath>/app</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                    <forceTags>true</forceTags>
                    <imageTags>
                        <imageTag>${project.version}</imageTag>
                        <imageTag>latest</imageTag>
                    </imageTags>
                    <useConfigFile>true</useConfigFile>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <configuration>
                    <skip>${maven.exec.skip}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>e2e-app</id>
                        <phase>integration-test</phase>
                        <configuration>
                            <executable>npm</executable>
                            <workingDirectory>../admin</workingDirectory>
                            <arguments>
                                <argument>run</argument>
                                <argument>e2e</argument>
                            </arguments>
                            <environmentVariables>
                                <TOMCAT_HTTP_PORT>${tomcat.http.port}</TOMCAT_HTTP_PORT>
                            </environmentVariables>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!--http://mydevnotes.nicus.it/2013/03/generate-ddl-with-maven-jpa-hibernate-4.html-->
                <!--http://stackoverflow.com/questions/28615977/how-to-use-hibernate4-maven-plugin-to-generate-multiple-dialects-schemas-->
                <groupId>de.juplo</groupId>
                <artifactId>hibernate4-maven-plugin</artifactId>
                <version>1.1.1</version>

                <!-- postgres -->
                <!--<executions>-->
                <!--<execution>-->
                <!--<id>postgres</id>-->
                <!--<goals>-->
                <!--<goal>export</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <!--<configuration>-->
                <!--<username>postgres</username>-->
                <!--<password>oe9jaacZLbR9pN</password>-->
                <!--<driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>-->
                <!--<hibernateDialect>org.hibernate.dialect.PostgreSQLDialect</hibernateDialect>-->
                <!--<url>jdbc:oracle:thin:@//192.168.99.100:1521/XE</url>-->
                <!--<target>SCRIPT</target>-->
                <!--<outputFile>${project.build.directory}/V1_2__PostgreSQL.sql</outputFile>-->
                <!--<type>create</type>-->
                <!--</configuration>-->
                <!--<dependencies>-->
                <!--<dependency>-->
                <!--<groupId>org.postgresql</groupId>-->
                <!--<artifactId>postgresql</artifactId>-->
                <!--<version>9.4.1212.jre7</version>-->
                <!--</dependency>-->
                <!--</dependencies>-->

                <!--oracle -->
                <!--<executions>-->
                <!--<execution>-->
                <!--<id>oracle</id>-->
                <!--<goals>-->
                <!--<goal>export</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <!--<configuration>-->
                <!--<username>system</username>-->
                <!--<password>oracle</password>-->
                <!--<driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>-->
                <!--<hibernateDialect>org.hibernate.dialect.Oracle10gDialect</hibernateDialect>-->
                <!--<url>jdbc:oracle:thin:@//192.168.99.100:1521/XE</url>-->
                <!--<target>SCRIPT</target>-->
                <!--<outputFile>${project.build.directory}/V1_2__Oracle.sql</outputFile>-->
                <!--<type>create</type>-->
                <!--</configuration>-->

                <!--mysql-->
                <!--<executions>-->
                <!--<execution>-->
                <!--<id>mysql</id>-->
                <!--<goals>-->
                <!--<goal>export</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <!--<configuration>-->
                <!--<username>root</username>-->
                <!--<password>password</password>-->
                <!--<driverClassName>com.mysql.cj.jdbc.Driver</driverClassName>-->
                <!--<hibernateDialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernateDialect>-->
                <!--<url>jdbc:mysql://192.168.99.100:3306/smsc</url>-->
                <!--<target>SCRIPT</target>-->
                <!--<outputFile>${project.build.directory}/V1_2__MySQL.sql</outputFile>-->
                <!--<type>create</type>-->
                <!--</configuration>-->
                <!--<dependencies>-->
                <!--<dependency>-->
                <!--<groupId>mysql</groupId>-->
                <!--<artifactId>mysql-connector-java</artifactId>-->
                <!--<version>6.0.5</version>-->
                <!--</dependency>-->
                <!--</dependencies>-->

                <!--h2-->
                <!--<executions>-->
                <!--<execution>-->
                <!--<id>h2</id>-->
                <!--<goals>-->
                <!--<goal>export</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <!--<configuration>-->
                <!--<driverClassName>org.h2.Driver</driverClassName>-->
                <!--<hibernateDialect>org.hibernate.dialect.H2Dialect</hibernateDialect>-->
                <!--<url>jdbc:h2:mem:smsc</url>-->
                <!--<target>SCRIPT</target>-->
                <!--<outputFile>${project.build.directory}/V1_2__H2.sql</outputFile>-->
                <!--<type>create</type>-->
                <!--</configuration>-->
                <!--<dependencies>-->
                <!--<dependency>-->
                <!--<groupId>com.h2database</groupId>-->
                <!--<artifactId>h2</artifactId>-->
                <!--<version>1.4.193</version>-->
                <!--</dependency>-->
                <!--</dependencies>-->

                <!--hsqldb-->
                <!--<executions>-->
                <!--<execution>-->
                <!--<id>hsqldb</id>-->
                <!--<goals>-->
                <!--<goal>export</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <!--<configuration>-->
                <!--<driverClassName>org.hsqldb.jdbcDriver</driverClassName>-->
                <!--<hibernateDialect>org.hibernate.dialect.HSQLDialect</hibernateDialect>-->
                <!--<url>jdbc:hsqldb:mem:smsc</url>-->
                <!--<target>SCRIPT</target>-->
                <!--<outputFile>${project.build.directory}/V1_2__HSQLDB.sql</outputFile>-->
                <!--<type>create</type>-->
                <!--</configuration>-->
                <!--<dependencies>-->
                <!--<dependency>-->
                <!--<groupId>org.hsqldb</groupId>-->
                <!--<artifactId>hsqldb</artifactId>-->
                <!--<version>2.3.4</version>-->
                <!--</dependency>-->
                <!--</dependencies>-->
            </plugin>
        </plugins>
    </build>
</project>
