<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed under European Space Agency Public License (ESA-PL) Weak Copyleft – v2.4
  You may not use this file except in compliance with the License.

  Except as expressly set forth in this License, the Software is provided to
  You on an "as is" basis and without warranties of any kind, including without
  limitation merchantability, fitness for a particular purpose, absence of
  defects or errors, accuracy or non-infringement of intellectual property rights.

  See the License for the specific language governing permissions and limitations under the License.
-->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>int.esa.ccsds.mo</groupId>
        <artifactId>parent</artifactId>
        <version>14.1</version>
        <relativePath/>
    </parent>
    <groupId>int.esa.nmf</groupId>
    <artifactId>nanosat-mo-framework</artifactId>
    <packaging>pom</packaging>
    <version>5.0</version>
    <name>ESA NanoSat MO Framework</name>
    <description>Maven Reactor for ESA Nanosat MO Framework</description>
    <url>https://nanosat-mo-framework.github.io</url>
    <organization>
        <name>ESA</name>
        <url>http://www.esa.int</url>
    </organization>
    <licenses>
        <license>
            <name>European Space Agency Public License (ESA-PL) Weak Copyleft – v2.4</name>
            <url>https://raw.github.com/esa/nanosat-mo-framework/master/LICENCE.md</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <issueManagement>
        <system>Gitlab</system>
        <url>https://gitlab.com/esa/NMF/nmf-issues/-/issues</url>
    </issueManagement>
    <scm>
        <connection>scm:git:https://github.com/esa/nanosat-mo-framework.git</connection>
        <url>https://github.com/esa/nanosat-mo-framework</url>
    </scm>
    <developers>
        <developer>
            <id>CesarCoelho</id>
            <name>César Coelho</name>
            <url>https://github.com/CesarCoelho</url>
        </developer>
        <developer>
            <id>dmarszk</id>
            <name>Dominik Marszk</name>
            <email>dominik.marszk@esa.int</email>
        </developer>
    </developers>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!-- NMF general properties -->
        <esa.nmf.version>5.0</esa.nmf.version>
        <central.publishing.plugin.version>0.9.0</central.publishing.plugin.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <!-- MO services XMLs attached to NMF -->
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>mo-services-xml</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <!-- MO service APIs specific to NMF -->
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>api-nmf-com</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>api-nmf-mc</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>api-nmf-sm</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>api-nmf-platform</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <!-- Services Implementations (Unified) -->
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>nmf-services-impl</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <!-- NMF Composites -->
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>nmf-composites</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>nmf-package-lib</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <dependency>
                <groupId>int.esa.nmf.core</groupId>
                <artifactId>nmf-package-maven-plugin</artifactId>
                <version>${esa.nmf.version}</version>
            </dependency>
            <!-- External Dependencies -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
            </dependency>
            <dependency>
                <groupId>org.xerial</groupId>
                <artifactId>sqlite-jdbc</artifactId>
                <version>3.49.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>3.6.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>11</source>
                        <target>11</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>int.esa.nmf.core</groupId>
                    <artifactId>nmf-package-maven-plugin</artifactId>
                    <version>${esa.nmf.version}</version>
                </plugin>
                <plugin>
                    <groupId>int.esa.nmf.core</groupId>
                    <artifactId>nmf-linux-maven-plugin</artifactId>
                    <version>${esa.nmf.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.6.0</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>${assembly.mainClass}</mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <finalName>${project.artifactId}-${project.version}</finalName>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>assembly-with-dependencies</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Publish to the Maven Central Portal via central-publishing (the
                 modern Sonatype Portal flow, as used by e.g. WildFly). This
                 overrides the nexus-staging deploy inherited from the MO parent:
                 nexus-staging defers its upload to the last reactor module, which
                 never fires in NMF's single-root layout (the aggregator root
                 builds first, and the last module skips staging). central-publishing
                 instead aggregates the whole reactor into one deployment at session
                 end, independent of module build order.

                 This profile merges with the inherited "release" profile, so the
                 source/javadoc/gpg-sign steps still apply; here we only swap the
                 deploy mechanism. -->
            <id>release</id>
            <build>
                <plugins>
                    <!-- Neutralise the nexus-staging plugin inherited from the parent. -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>false</extensions>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- The Portal plugin performs the upload; disable the stock deploy. -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central.publishing.plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <!-- Reuses the existing "ossrh" server (a Central Portal
                                 token) from settings.xml; change if you use another id. -->
                            <publishingServerId>ossrh</publishingServerId>
                            <!-- Upload and validate only. Publishing is done manually
                                 from https://central.sonatype.com after reviewing the
                                 validated deployment. -->
                            <autoPublish>false</autoPublish>
                            <waitUntil>validated</waitUntil>
                            <deploymentName>nanosat-mo-framework-${project.version}</deploymentName>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <modules>
        <module>core</module>
        <module>nmf-mission-barebone</module>
        <module>mission/simulator</module>
        <module>sdk</module>
    </modules>
</project>