<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>us.hebi.matlab.mat</groupId>
    <artifactId>mfl-parent</artifactId>
    <packaging>pom</packaging>
    <version>0.5.15</version>

    <name>MAT File Library</name>
    <url>https://github.com/HebiRobotics/MFL</url>
    <description>
        Java library for reading and writing MAT Files that are compatible with MATLAB's MAT-File Format
    </description>

    <organization>
        <name>HEBI Robotics</name>
        <url>http://www.hebirobotics.com</url>
    </organization>
    <inceptionYear>2018</inceptionYear>

    <!-- Maven Central configuration copied from https://github.com/davidcarboni/releaser -->
    <!-- Required: license information: -->
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <!-- Required: source control information: -->
    <scm>
        <url>https://github.com/HebiRobotics/MFL</url>
        <connection>scm:git:git://github.com/HebiRobotics/MFL.git</connection>
        <developerConnection>scm:git:git@github.com:HebiRobotics/MFL.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <!-- Maven Central Distribution -->
    <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>

    <!-- Required: developer information: -->
    <developers>
        <developer>
            <id>ennerf</id>
            <name>Florian Enner</name>
            <email>florian@hebirobotics.com</email>
            <url>https://github.com/ennerf</url>
            <organization>HEBI Robotics</organization>
            <organizationUrl>https://github.com/HebiRobotics</organizationUrl>
        </developer>
    </developers>

    <modules>
        <module>mfl-core</module>
        <module>mfl-ejml</module>
    </modules>

    <properties>

        <!-- Set Syntax level to Java 8 so that IDEs (IntelliJ) don't complain about using
        Java 8 syntax (e.g. try-with-resources) in unit tests -->
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>

        <!-- Sets the actual target source target for a 2nd compilation pass  -->
        <javaTarget />

        <!-- Jigsaw module name -->
        <javaModuleName />

        <!-- Other Settings -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <gpg.keyname /> <!-- set via settings.xml to sign release artifacts-->

        <!-- License Headers (http://www.mojohaus.org/license-maven-plugin/update-file-header-mojo.html) -->
        <license.licenseName>apache_v2</license.licenseName>
        <license.addJavaLicenseAfterPackage>false</license.addJavaLicenseAfterPackage>
        <license.trimHeaderLine>true</license.trimHeaderLine>

        <!-- For now, disable 'missing' warnings about undocumented @param and @throws -->
        <doclint>html,syntax,accessibility,reference</doclint>

    </properties>

    <!-- Dependency management (keep in alphabetical order) -->
    <dependencyManagement>
        <dependencies>

            <dependency> <!-- EJML linear algebra library -->
                <groupId>org.ejml</groupId>
                <artifactId>ejml-core</artifactId>
                <version>0.37</version>
                <scope>provided</scope> <!-- Supplied by user -->
            </dependency>

            <dependency> <!-- Unit Tests -->
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.1</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>

        <!-- Plugins required for publishing to Maven Central -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-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-gpg-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>
        </plugins>

        <!-- Configuration for plugins required for publishing to Maven Central -->
        <pluginManagement>
            <plugins>

                <!-- Compile in 2 stages so we use a higher target in source -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <executions>
                        <!-- 1) default-compile: compiles sources w/ Java 8 -->
                        <!-- 2) default-testCompile: compiles tests w/ Java 8 -->
                        <!-- 3) Re-compiles sources for target VM -->
                        <execution>
                            <id>target-compile</id>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <source>${javaTarget}</source>
                                <target>${javaTarget}</target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- Add licenses to files -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>1.16</version>
                    <executions>
                        <execution>
                            <id>first</id>
                            <goals>
                                <goal>update-file-header</goal>
                            </goals>
                            <phase>process-sources</phase>
                        </execution>
                    </executions>
                </plugin>

                <!-- Optional: ensure the manifest contains artifact version information: -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                            <manifestEntries>
                                <Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>

                <!-- Required: Source Jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Required: Javadoc Jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadoc</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Release -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <localCheckout>true</localCheckout>
                        <pushChanges>false</pushChanges>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                    </configuration>
                </plugin>

                <!-- Deployment -->
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>

        <!-- GPG Signature on release -->
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <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>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>


</project>
