<?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>io.archimedesfw.maven.micronaut</groupId>
        <artifactId>micronaut-kotlin-parent</artifactId>
        <version>3.7.4</version>
    </parent>

    <groupId>io.archimedesfw</groupId>
    <artifactId>archimedes-parent</artifactId>
    <version>0.2.0</version>
    <packaging>pom</packaging>

    <properties>
        <mockito.version>4.9.0</mockito.version>
        <mockito-kotlin.version>4.1.0</mockito-kotlin.version>
        <postgresql.version>42.5.1</postgresql.version>

        <docker-maven-plugin.version>0.40.2</docker-maven-plugin.version>
        <dokka-maven-plugin.version>1.7.20</dokka-maven-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-release-plugin.version>3.0.0-M7</maven-release-plugin.version>

        <it.postgresql.image>postgres:14-alpine</it.postgresql.image>
        <it.postgresql.host>localhost</it.postgresql.host>
        <it.postgresql.port>5432</it.postgresql.port>
        <it.postgresql.db>archimedes</it.postgresql.db>
        <it.postgresql.password>verysecret</it.postgresql.password>
    </properties>

    <modules>
        <module>archimedes-bom</module>

        <module>archimedes-commons-lang</module>
        <module>archimedes-commons-logging-slf4j</module>
        <module>archimedes-context-micronaut</module>
        <module>archimedes-cqrs</module>
        <module>archimedes-cqrs-micronaut</module>
        <module>archimedes-data-tx</module>
        <module>archimedes-data-tx-action</module>
        <module>archimedes-data-tx-micronaut</module>
<!--        <module>archimedes-data-tx-spring</module>-->
        <module>archimedes-data-jdbc</module>
        <module>archimedes-data-jdbc-micronaut</module>
<!--        <module>archimedes-data-jdbc-spring</module>-->
        <module>archimedes-security</module>
        <module>archimedes-security-auth-micronaut</module>
        <module>archimedes-usecase</module>
        <module>archimedes-usecase-test</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgresql.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- ====================== Testing dependencies ========================== -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito.kotlin</groupId>
            <artifactId>mockito-kotlin</artifactId>
            <version>${mockito-kotlin.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.micronaut.test</groupId>
            <artifactId>micronaut-test-junit5</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>${docker-maven-plugin.version}</version>
                    <configuration>
                        <images>
                            <image>
                                <name>${it.postgresql.image}</name>
                                <run>
                                    <ports>
                                        <port>${it.postgresql.port}:5432</port>
                                    </ports>
                                    <env>
                                        <POSTGRES_PASSWORD>${it.postgresql.password}</POSTGRES_PASSWORD>
                                        <POSTGRES_DB>${it.postgresql.db}</POSTGRES_DB>
                                    </env>
                                    <wait>
                                        <log>database system is ready to accept connections</log>
                                    </wait>
                                </run>
                            </image>
                        </images>
                    </configuration>
                    <executions>
                        <execution>
                            <id>start</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>start</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>stop</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <scmCommentPrefix>[skip ci]</scmCommentPrefix>
                        <tagNameFormat>v@{project.version}</tagNameFormat>
                        <projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <name>${project.artifactId}</name>
    <description>Archimedes Maven pom parent. Not for general use, just to share configuration over the rest of
        Archimedes modules.
    </description>
    <url>https://www.archimedesfw.io/</url>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:https://github.com/archimedes-projects/archimedes-jvm.git</connection>
        <developerConnection>scm:git:https://github.com/archimedes-projects/archimedes-jvm.git</developerConnection>
        <tag>v0.2.0</tag>
        <url>https://github.com/archimedes-projects/archimedes-jvm</url>
    </scm>
    <developers>
        <developer>
            <id>alejandropg</id>
            <name>Alejandro Pérez</name>
        </developer>
    </developers>

    <profiles>
        <profile>
            <id>release</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
            </distributionManagement>
            <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-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>dokka-site</id>
                                <phase>pre-site</phase>
                                <goals>
                                    <goal>dokka</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>dokka-javadocJar</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <jdkVersion>${jdk.version}</jdkVersion>
                            <sourceDirectories>
                                <dir>${project.basedir}/src/main/kotlin</dir>
                            </sourceDirectories>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.13</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
