<?xml version="1.0"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>net.laprun.sustainability</groupId>
    <artifactId>power-server-parent</artifactId>
    <version>0.2.3</version>
    <packaging>pom</packaging>

    <name>power-server : parent</name>
    <description>An application allowing to retrieve power consumption and associated metadata on a per-process basis,
        via a RESTful endpoint
    </description>
    <url>https://github.com/metacosm/power-server</url>

    <licenses>
        <license>
            <name>Apache 2 License</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Christophe Laprun</name>
            <email>metacosm@gmail.com</email>
            <roles>
                <role>author</role>
            </roles>
        </developer>
    </developers>
    <inceptionYear>2023</inceptionYear>

    <scm>
        <connection>scm:git:git://github.com/metacosm/power-server.git</connection>
        <developerConnection>scm:git:git@github.com/metacosm/power-server.git</developerConnection>
        <url>https://github.com/metacosm/power-server/tree/main</url>
      <tag>0.2.3</tag>
  </scm>


    <properties>
        <compiler-plugin.version>3.14.0</compiler-plugin.version>
        <maven.compiler.release>21</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
        <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
        <skipITs>true</skipITs>
        <format.skip>false</format.skip>

        <quarkus.platform.version>3.24.2</quarkus.platform.version>
        <assertj.version>3.27.3</assertj.version>

        <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.5.3</maven-failsafe-plugin.version>
        <formatter-plugin.version>2.27.0</formatter-plugin.version>
        <impsort-plugin.version>1.12.0</impsort-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
        <central-maven-publishing-plugin.version>0.8.0</central-maven-publishing-plugin.version>
        <maven-release-plugin.version>3.1.1</maven-release-plugin.version>
        <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
        <buildnumber-maven-plugin.version>3.2.1</buildnumber-maven-plugin.version>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <os-maven-plugin.version>1.7.1</os-maven-plugin.version>
        <maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
        <jreleaser.version>1.19.0</jreleaser.version>
    </properties>

    <modules>
        <module>metadata</module>
        <module>measure</module>
        <module>server</module>
        <module>analysis</module>
        <module>if-manifest-export</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>${quarkus.platform.artifact-id}</artifactId>
                <version>${quarkus.platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-arc</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest-jackson</artifactId>
        </dependency>
        <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>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${formatter-plugin.version}</version>
                    <configuration>
                        <configFile>contributing/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>${impsort-plugin.version}</version>
                    <configuration>
                        <removeUnused>true</removeUnused>
                        <groups>java.,javax.,jakarta.,org.,com.</groups>
                        <staticGroups>*</staticGroups>
                        <skip>${format.skip}</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>${quarkus.platform.group-id}</groupId>
                    <artifactId>quarkus-maven-plugin</artifactId>
                    <version>${quarkus.platform.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>${compiler-plugin.version}</version>
                    <configuration>
                        <compilerArgs>
                            <arg>-parameters</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>me.fabriciorby</groupId>
                            <artifactId>maven-surefire-junit5-tree-reporter</artifactId>
                            <version>1.4.0</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <reportFormat>plain</reportFormat>
                        <consoleOutputReporter>
                            <disable>true</disable>
                        </consoleOutputReporter>
                        <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
                            <theme>UNICODE</theme>
                            <printStacktraceOnError>true</printStacktraceOnError>
                            <printStacktraceOnFailure>true</printStacktraceOnFailure>
                            <printStdoutOnError>true</printStdoutOnError>
                            <printStdoutOnFailure>true</printStdoutOnFailure>
                            <printStdoutOnSuccess>false</printStdoutOnSuccess>
                            <printStderrOnError>true</printStderrOnError>
                            <printStderrOnFailure>true</printStderrOnFailure>
                            <printStderrOnSuccess>false</printStderrOnSuccess>
                        </statelessTestsetInfoReporter>
                        <systemPropertyVariables>
                            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            <maven.home>${maven.home}</maven.home>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-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>
                                    <maven.home>${maven.home}</maven.home>
                                </systemPropertyVariables>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-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>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>format</id>
            <activation>
                <!-- This profile is effectively activated by default -->
                <property>
                    <name>!no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>format-sources</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sort-imports</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>sort</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jreleaser</groupId>
                        <artifactId>jreleaser-maven-plugin</artifactId>
                        <version>${jreleaser.version}</version>
                        <configuration>
                            <jreleaser>
                                <release>
                                    <github>
                                        <changelog>
                                            <formatted>ALWAYS</formatted>
                                            <preset>conventional-commits</preset>
                                        </changelog>
                                    </github>
                                </release>
                                <distributions>
                                    <power-server>
                                        <name>power-server</name>
                                        <type>BINARY</type>
                                        <brew>
                                            <active>RELEASE</active>
                                            <multiPlatform>true</multiPlatform>
                                        </brew>
                                        <sdkman>
                                            <active>RELEASE</active>
                                        </sdkman>
                                        <artifacts>
                                            <artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.tar.gz
                                                </transform>
                                                <platform>linux-x86_64</platform>
                                            </artifact>
                                            <!--<artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-windows-x86_64.zip
                                                </transform>
                                                <platform>windows-x86_64</platform>
                                            </artifact>-->
                                            <artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.tar.gz
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-x86_64.tar.gz
                                                </transform>
                                                <platform>osx-x86_64</platform>
                                            </artifact>
                                            <artifact>
                                                <path>
                                                    {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-aarch_64.tar.gz
                                                </path>
                                                <transform>
                                                    artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-aarch_64.tar.gz
                                                </transform>
                                                <platform>osx-aarch_64</platform>
                                            </artifact>
                                        </artifacts>
                                    </power-server>
                                </distributions>
                            </jreleaser>
                        </configuration>
                    </plugin>
                    <!-- Set properties containing the scm revision -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>buildnumber-maven-plugin</artifactId>
                        <version>${buildnumber-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>get-scm-revision</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>create</goal>
                                </goals>
                                <configuration>
                                    <doCheck>false</doCheck>
                                    <doUpdate>false</doUpdate>
                                    <revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
                                    <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>${maven-jar-plugin.version}</version>
                        <configuration>
                            <archive>
                                <index>true</index>
                                <manifest>
                                    <addDefaultSpecificationEntries>
                                        true
                                    </addDefaultSpecificationEntries>
                                    <addDefaultImplementationEntries>
                                        true
                                    </addDefaultImplementationEntries>
                                </manifest>
                                <manifestEntries>
                                    <Implementation-URL>${project.url}</Implementation-URL>
                                    <Java-Version>${java.version}</Java-Version>
                                    <Java-Vendor>${java.vendor}</Java-Vendor>
                                    <Os-Name>${os.name}</Os-Name>
                                    <Os-Arch>${os.arch}</Os-Arch>
                                    <Os-Version>${os.version}</Os-Version>
                                    <Scm-Url>${project.scm.url}</Scm-Url>
                                    <Scm-Connection>${project.scm.connection}</Scm-Connection>
                                    <Scm-Revision>${buildNumber}</Scm-Revision>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <configuration>
                            <archive>
                                <index>true</index>
                                <manifest>
                                    <addDefaultSpecificationEntries>
                                        true
                                    </addDefaultSpecificationEntries>
                                    <addDefaultImplementationEntries>
                                        true
                                    </addDefaultImplementationEntries>
                                </manifest>
                                <manifestEntries>
                                    <Implementation-URL>${project.url}</Implementation-URL>
                                    <Java-Version>${java.version}</Java-Version>
                                    <Java-Vendor>${java.vendor}</Java-Vendor>
                                    <Os-Name>${os.name}</Os-Name>
                                    <Os-Arch>${os.arch}</Os-Arch>
                                    <Os-Version>${os.version}</Os-Version>
                                    <Scm-Url>${project.scm.url}</Scm-Url>
                                    <Scm-Connection>${project.scm.connection}</Scm-Connection>
                                    <Scm-Revision>${buildNumber}</Scm-Revision>
                                </manifestEntries>
                            </archive>
                        </configuration>
                        <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-gpg-plugin</artifactId>
                        <version>${maven-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>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>${maven-release-plugin.version}</version>
                        <configuration>
                            <preparationGoals>clean install</preparationGoals>
                            <autoVersionSubmodules>true</autoVersionSubmodules>
                            <useReleaseProfile>false</useReleaseProfile>
                            <releaseProfiles>release</releaseProfiles>
                            <goals>deploy</goals>
                            <tagNameFormat>@{project.version}</tagNameFormat>
                            <pushChanges>false</pushChanges>
                            <localCheckout>true</localCheckout>
                            <remoteTagging>false</remoteTagging>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-maven-publishing-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <autoPublish>true</autoPublish>
                            <tokenAuth>true</tokenAuth>
                            <excludeArtifacts>build-tools</excludeArtifacts>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>native</id>
            <activation>
                <property>
                    <name>native</name>
                </property>
            </activation>
            <properties>
                <skipITs>false</skipITs>
                <quarkus.package.type>native</quarkus.package.type>
            </properties>
        </profile>
    </profiles>
</project>
