<?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>com.rbkmoney</groupId>
        <artifactId>service-parent-pom</artifactId>
        <version>2.0.2</version>
    </parent>

    <artifactId>{{kebabCase name}}</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>{{kebabCase name}}</name>
    <description>{{description}}</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>15</java.version>
        {{#if_eq language 'Kotlin'}}
        <kotlin.version>1.4.31</kotlin.version>
        {{/if_eq}}
        <server.port>8022</server.port>
        <management.port>8023</management.port>
        <exposed.ports>${server.port} ${management.port}</exposed.ports>
        <dockerfile.registry>${env.REGISTRY}</dockerfile.registry>
    </properties>

    <dependencies>
        {{#if_eq language 'Kotlin'}}
        <!--kotlin-->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
        </dependency>
        {{/if_eq}}

        <!--rbkmoney-->
        <dependency>
            <groupId>com.rbkmoney</groupId>
            <artifactId>custom-metrics-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.rbkmoney</groupId>
            <artifactId>custom-actuator-endpoints</artifactId>
        </dependency>
        <dependency>
            <groupId>com.rbkmoney.woody</groupId>
            <artifactId>woody-thrift</artifactId>
        </dependency>
        <dependency>
            <groupId>com.rbkmoney</groupId>
            <artifactId>shared-resources</artifactId>
        </dependency>

        <!--spring-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <!--third party-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        {{#if_eq language 'Java'}}
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        {{/if_eq}}
        {{#if_eq language 'Kotlin'}}
        <dependency>
            <groupId>io.github.microutils</groupId>
            <artifactId>kotlin-logging-jvm</artifactId>
        </dependency>
        {{/if_eq}}

        <!--test-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        {{#if_eq language 'Kotlin'}}
        <dependency>
            <groupId>org.mockito.kotlin</groupId>
            <artifactId>mockito-kotlin</artifactId>
            <scope>test</scope>
        </dependency>
        {{/if_eq}}
    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/{{lowerCase language}}</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/{{lowerCase language}}</testSourceDirectory>
        <resources>
            <resource>
                <directory>${project.build.directory}/maven-shared-archive-resources</directory>
                <targetPath>${project.build.directory}</targetPath>
                <includes>
                    <include>Dockerfile</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>${project.build.directory}/maven-shared-archive-resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>Dockerfile</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            {{#if_eq language 'Kotlin'}}
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                        <plugin>jpa</plugin>
                    </compilerPlugins>
                </configuration>
                <executions>
                    <execution>
                        <id>kapt</id>
                        <goals>
                            <goal>kapt</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>src/main/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-allopen</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-noarg</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.github.gantsign.maven</groupId>
                <artifactId>ktlint-maven-plugin</artifactId>
                <version>1.9.0</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            {{/if_eq}}
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.6.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.shared</groupId>
                        <artifactId>maven-filtering</artifactId>
                        <version>1.3</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <resourceBundles>
                        <resourceBundle>com.rbkmoney:shared-resources:${shared-resources.version}</resourceBundle>
                    </resourceBundles>
                    <attachToMain>false</attachToMain>
                    <attachToTest>false</attachToTest>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
