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

    <groupId>io.github.onecx</groupId>
    <artifactId>onecx-quarkus2-parent</artifactId>
    <version>0.13.0</version>
    <name>onecx-quarkus2-parent</name>
    <packaging>pom</packaging>

    <description>Onecx Quarkus application parent</description>
    <url>https://github.com/onecx/onecx-quarkus2-parent</url>

    <organization>
        <name>onecx</name>
        <url>https://github.com/onecx</url>
    </organization>

    <developers>
        <developer>
            <id>tkit-dev</id>
            <name>tkit-dev</name>
            <organization>onecx</organization>
            <organizationUrl>https://github.com/onecx</organizationUrl>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache 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:git@github.com:onecx/onecx-quarkus2-parent.git</connection>
        <developerConnection>scm:git:git@github.com:onecx/onecx-quarkus2-parent.git</developerConnection>
        <url>https://github.com/onecx/onecx-quarkus2-parent</url>
    </scm>

    <properties>
        <!-- build -->
        <format.skip>false</format.skip>
        <enforcer.skip>false</enforcer.skip>
        <enforce-test-deps-scope.skip>${enforcer.skip}</enforce-test-deps-scope.skip>

        <!-- Quarkus configuration -->
        <quarkus.version>2.16.6.Final</quarkus.version>
        <quarkus.smallrye-open-api.version>3.1.1</quarkus.smallrye-open-api.version>
        <quarkiverse.quarkus-openapi-generator.version>1.3.1</quarkiverse.quarkus-openapi-generator.version>
        <quarkiverse.mockserver.version>0.6.0</quarkiverse.mockserver.version>

        <!-- tkit -->
        <tkit.quarkus.version>0.13.0</tkit.quarkus.version>

        <!-- Maven configuration -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.parameters>true</maven.compiler.parameters>
        <maven.compiler-plugin.version>3.10.1</maven.compiler-plugin.version>
        <maven.surefire-plugin.version>3.0.0</maven.surefire-plugin.version>
        <maven.formatter-plugin.version>2.22.0</maven.formatter-plugin.version>
        <maven.impsort-plugin.version>1.8.0</maven.impsort-plugin.version>
        <maven.enforcer-plugin.version>3.2.1</maven.enforcer-plugin.version>

        <!-- Maven central release configuration -->
        <nexus.staging-plugin.version>1.6.13</nexus.staging-plugin.version>
        <source-plugin.version>3.2.1</source-plugin.version>
        <javadoc-plugin.version>3.5.0</javadoc-plugin.version>
        <gpg-plugin.version>3.0.1</gpg-plugin.version>

        <!-- Sonar -->
        <sonar.coverage.exclusions>
            **/model*/**/*.*,**/resources/**/*.*,**/JaxRsActivator*
        </sonar.coverage.exclusions>
<!--        <sonar.exclusions></sonar.exclusions>-->

        <!-- Other -->
        <projectlombok.version>1.18.26</projectlombok.version>
        <projectlombok.mapstruct-binding.version>0.2.0</projectlombok.mapstruct-binding.version>
        <mapstruct.version>1.5.5.Final</mapstruct.version>
        <assertj.version>3.24.2</assertj.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-bom</artifactId>
                <version>${quarkus.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.tkit.quarkus.lib</groupId>
                <artifactId>tkit-quarkus-bom</artifactId>
                <version>${tkit.quarkus.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${projectlombok.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct</artifactId>
                <version>${mapstruct.version}</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>io.quarkiverse.openapi.generator</groupId>
                <artifactId>quarkus-openapi-generator</artifactId>
                <version>${quarkiverse.quarkus-openapi-generator.version}</version>
            </dependency>
            <dependency>
                <groupId>io.quarkiverse.mockserver</groupId>
                <artifactId>quarkus-mockserver</artifactId>
                <version>${quarkiverse.mockserver.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>io.quarkiverse.mockserver</groupId>
                <artifactId>quarkus-mockserver-test</artifactId>
                <version>${quarkiverse.mockserver.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>


        <!-- Build -->
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-container-image-docker</artifactId>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jacoco</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>io.smallrye</groupId>
                    <artifactId>smallrye-open-api-maven-plugin</artifactId>
                    <version>${quarkus.smallrye-open-api.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <version>${quarkus.version}</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                            <goal>generate-code</goal>
                            <goal>generate-code-tests</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler-plugin.version}</version>
                <configuration>
                    <compilerArgs>
                        <arg>-parameters</arg>
                        <arg>-Amapstruct.defaultComponentModel=cdi</arg>
                        <arg>-Amapstruct.defaultInjectionStrategy=constructor</arg>
                    </compilerArgs>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${mapstruct.version}</version>
                        </path>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${projectlombok.version}</version>
                        </path>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok-mapstruct-binding</artifactId>
                            <version>${projectlombok.mapstruct-binding.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire-plugin.version}</version>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <!--suppress UnresolvedMavenProperty -->
                        <maven.home>${maven.home}</maven.home>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven.surefire-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <systemPropertyVariables>
                                <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                                <!--suppress UnresolvedMavenProperty -->
                                <maven.home>${maven.home}</maven.home>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>${maven.formatter-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>io.quarkus</groupId>
                        <artifactId>quarkus-ide-config</artifactId>
                        <version>${quarkus.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <configFile>eclipse-format.xml</configFile>
                    <lineEnding>LF</lineEnding>
                    <skip>${format.skip}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
                <version>${maven.impsort-plugin.version}</version>
                <configuration>
                    <groups>java.,javax.,jakarta.,org.,com.</groups>
                    <staticGroups>*</staticGroups>
                    <skip>${format.skip}</skip>
                    <removeUnused>true</removeUnused>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven.enforcer-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>io.quarkus</groupId>
                        <artifactId>quarkus-enforcer-rules</artifactId>
                        <version>${quarkus.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <dependencyConvergence/>
                                <externalRules>
                                    <location>classpath:enforcer-rules/quarkus-require-java-version.xml</location>
                                </externalRules>
                                <externalRules>
                                    <location>classpath:enforcer-rules/quarkus-require-maven-version.xml</location>
                                </externalRules>
                                <externalRules>
                                    <location>classpath:enforcer-rules/quarkus-banned-dependencies.xml</location>
                                </externalRules>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>enforce-banned-deps</id>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>io.quarkus:quarkus-config-yaml</exclude>
                                        <exclude>junit:junit</exclude>
                                        <exclude>commons-lang:commons-lang</exclude>
                                        <exclude>commons-collections:commons-collections</exclude>
                                        <exclude>org.apache.commons:commons-lang3</exclude>
                                        <exclude>org.apache.commons:commons-text</exclude>
                                        <exclude>com.google.code.gson:gson</exclude>
                                        <exclude>com.google.guava:guava</exclude>
                                        <exclude>com.squareup.okhttp3:*</exclude>
                                        <exclude>com.alibaba:*</exclude>
                                        <exclude>org.glassfish:*</exclude>
                                        <exclude>org.jboss.resteasy:*</exclude>
                                        <exclude>io.swagger:*</exclude>
                                        <exclude>io.swagger.core.v3:*</exclude>
                                        <exclude>io.specto:hoverfly-java</exclude>
                                        <exclude>org.mockito:mockito-junit-jupiter</exclude>
                                        <exclude>commons-validator:commons-validator</exclude>
                                    </excludes>
                                    <message>Found banned dependencies</message>
                                    <searchTransitive>false</searchTransitive>
                                </bannedDependencies>
                            </rules>
                            <skip>${enforce-test-deps-scope.skip}</skip>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>enforce-test-deps-scope</id>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>io.quarkus:quarkus-test-*</exclude>
                                        <exclude>io.rest-assured:*</exclude>
                                        <exclude>org.assertj:*</exclude>
                                    </excludes>
                                    <includes>
                                        <include>io.quarkus:quarkus-test-*:*:*:test</include>
                                        <include>io.rest-assured:*:*:*:test</include>
                                        <include>org.assertj:*:*:*:test</include>
                                    </includes>
                                    <message>Found test dependencies with wrong scope:</message>
                                </bannedDependencies>
                            </rules>
                            <skip>${enforce-test-deps-scope.skip}</skip>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>enforce-test-deps-junit-scope</id>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <searchTransitive>false</searchTransitive>
                                    <excludes>
                                        <exclude>org.junit.jupiter:*</exclude>
                                    </excludes>
                                    <includes>
                                        <include>org.junit.jupiter:*:*:*:test</include>
                                    </includes>
                                    <message>Found JUnit dependencies with wrong scope:</message>
                                </bannedDependencies>
                            </rules>
                            <skip>${enforce-test-deps-scope.skip}</skip>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- Profiles -->
    <profiles>
        <profile>
            <id>native</id>
            <activation>
                <property>
                    <name>native</name>
                </property>
            </activation>
            <properties>
                <skipITs>false</skipITs>
                <quarkus.package.type>native</quarkus.package.type>
            </properties>
        </profile>
        <profile>
            <id>openapi</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.smallrye</groupId>
                        <artifactId>smallrye-open-api-maven-plugin</artifactId>                        
                        <version>${quarkus.smallrye-open-api.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>generate-schema</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>format</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>!no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <version>${maven.formatter-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <version>${maven.impsort-plugin.version}</version>
                        <configuration>
                            <removeUnused>true</removeUnused>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sort-imports</id>
                                <goals>
                                    <goal>sort</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>validate</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <version>${maven.formatter-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <version>${maven.impsort-plugin.version}</version>
                        <configuration>
                            <removeUnused>true</removeUnused>
                        </configuration>
                        <executions>
                            <execution>
                                <id>check-imports</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus.staging-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                            <stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
                        </configuration>
                    </plugin>
                    <!-- Generate source code artifact -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Generate javadoc artifact -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Sign artifacts before upload -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <!-- Maven central repository -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

</project>
