<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0"
    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>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>

    <name>codbex - platform - parent</name>

    <groupId>com.codbex.platform</groupId>
    <artifactId>codbex-platform-parent</artifactId>
    <version>1.0.13</version>
    <packaging>pom</packaging>

    <inceptionYear>2024</inceptionYear>

    <properties>
        <!-- Encoding -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <dirigible.version>10.5.10</dirigible.version>
        <codbex-platform-settings.version>1.0.0</codbex-platform-settings.version>

        <!-- Java -->
        <java.version>17</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

        <!-- Maven -->
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version>
        <maven-jacoco-plugin.version>0.8.12</maven-jacoco-plugin.version>
        <maven-git-commit-id-plugin.version>4.9.10</maven-git-commit-id-plugin.version>
        <maven-license-plugin.version>4.5</maven-license-plugin.version>
        <maven-spring-boot-plugin.version>3.3.0</maven-spring-boot-plugin.version>
        <maven-formatter-plugin.version>2.23.0</maven-formatter-plugin.version>
        <maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
        <maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>

        <formatter.java.version>${java.version}</formatter.java.version>

        <!-- Default configurations -->
        <skipTests>false</skipTests>
        <skipITs>true</skipITs>
        <skip.code.formatting>false</skip.code.formatting>
        <maven.javadoc.skip>false</maven.javadoc.skip>
        <license.skip>false</license.skip>

    </properties>

    <licenses>
        <license>
            <name>Eclipse Public License - v 2.0</name>
            <url>https://www.eclipse.org/legal/epl-v20.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <url>https://codbex.com</url>

    <scm>
        <url>https://github.com/codbex/codbex-platform-parent</url>
    </scm>
    <issueManagement>
        <url>https://github.com/codbex/codbex-platform-parent/issues</url>
    </issueManagement>

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

    <repositories>
        <repository>
            <id>mvnrepository</id>
            <url>https://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>

    <organization>
        <name>codbex</name>
        <url>https://www.codbex.com</url>
    </organization>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.eclipse.dirigible</groupId>
                <artifactId>dirigible-dependencies</artifactId>
                <version>${dirigible.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>dirigible.properties</include>
                </includes>
            </resource>

        </resources>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <skipTests>${skipTests}</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <configuration>
                        <skipITs>${skipITs}</skipITs>
                        <classesDirectory>${project.build.outputDirectory}</classesDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <version>${maven-git-commit-id-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>get-the-git-infos</id>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <dotGitDirectory>../.git</dotGitDirectory>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${maven-jacoco-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <rules>
                            <rule>
                                <element>SOURCEFILE</element>
                                <excludes>
                                    <exclude>*src/test/*</exclude>
                                </excludes>
                            </rule>
                        </rules>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                        <debug>true</debug>
                        <debuglevel>lines,vars,source</debuglevel>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${maven-license-plugin.version}</version>
                    <inherited>true</inherited>
                    <configuration>
                        <header>
                            ${project.build.directory}/unpacked-dependencies/licensing-header.txt</header>
                        <aggregate>true</aggregate>
                        <properties>
                            <inceptionYear>${project.inceptionYear}</inceptionYear>
                            <currentYear>${currentYear}</currentYear>
                        </properties>
                        <includes>
                            <include>src/**/*.java</include>
                            <include>src/**/*.xml</include>
                            <include>src/**/*.js</include>
                        </includes>
                        <excludes>
                            <exclude>**/logback.xml</exclude>
                            <exclude>**/logback-test.xml</exclude>
                            <exclude>**/src/test/resources/**</exclude>
                            <exclude>resources/resources-neo-sdk/**</exclude>
                        </excludes>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.codbex.platform</groupId>
                            <artifactId>codbex-platform-settings</artifactId>
                            <version>${codbex-platform-settings.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.mycila</groupId>
                            <artifactId>license-maven-plugin-git</artifactId>
                            <version>${maven-license-plugin.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>format-license</id>
                            <phase>initialize</phase>
                            <goals>
                                <goal>format</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${maven-spring-boot-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${maven-formatter-plugin.version}</version>
                    <configuration>
                        <skip>${skip.code.formatting}</skip>
                        <configFile>codbex-formatter.xml</configFile>
                        <compilerSource>${formatter.java.version}</compilerSource>
                        <compilerCompliance>${formatter.java.version}</compilerCompliance>
                        <compilerTargetPlatform>${formatter.java.version}</compilerTargetPlatform>
                    </configuration>
                    <executions>
                        <execution>
                            <id>format-java-code</id>
                            <phase>process-sources</phase>
                            <goals>
                                <goal>format</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.codbex</groupId>
                            <artifactId>platform-settings</artifactId>
                            <version>${codbex-platform-settings.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>copy-dependencies</id>
                            <phase>initialize</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/unpacked-dependencies</outputDirectory>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>com.codbex</groupId>
                                        <artifactId>platform-settings</artifactId>
                                        <version>${codbex-platform-settings.version}</version>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!-- Prevent gpg from using pinentry
                                            programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>tests</id>
            <properties>
                <skipTests>false</skipTests>
                <skipITs>false</skipITs>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <license.skip>true</license.skip>
                <skip.code.formatting>true</skip.code.formatting>
            </properties>
        </profile>
        <profile>
            <id>unit-tests</id>
            <properties>
                <skipTests>false</skipTests>
                <skipITs>true</skipITs>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <license.skip>true</license.skip>
                <skip.code.formatting>true</skip.code.formatting>
            </properties>
        </profile>
        <profile>
            <id>integration-tests</id>
            <properties>
                <skipITs>false</skipITs>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <license.skip>true</license.skip>
                <skip.code.formatting>true</skip.code.formatting>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>quick-build</id>
            <properties>
                <skipTests>true</skipTests>
                <skipITs>true</skipITs>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <license.skip>true</license.skip>
                <skip.code.formatting>true</skip.code.formatting>
            </properties>
        </profile>
        <profile>
            <id>format</id>
            <properties>
                <skipTests>true</skipTests>
                <skipITs>true</skipITs>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <license.skip>true</license.skip>
                <skip.code.formatting>false</skip.code.formatting>
            </properties>
        </profile>
    </profiles>

</project>
