<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</groupId>
    <artifactId>mat-file-io</artifactId>
    <version>0.2</version>
    <packaging>jar</packaging>

    <name>Mat-File IO</name>
    <description>
        Java library for reading and writing MAT Files that are compatible with MATLAB's MAT-File Format
    </description>
    <url>https://github.com/HebiRobotics/MatFileIO</url>

    <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/MatFileIO</url>
        <connection>scm:git:git://github.com/HebiRobotics/MatFileIO.git</connection>
        <developerConnection>scm:git:git@github.com:HebiRobotics/MatFileIO.git</developerConnection>
        <tag>mat-file-io-0.2</tag>
    </scm>

    <!-- Maven Central Distribution -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://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>

    <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>

        <!-- Set the actual target to minimum Java version compatible with Matlab >2009a -->
        <matlab.target>1.6</matlab.target>

        <!-- 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) -->
    <dependencies>

        <dependency> <!-- for custom serialization tests -->
            <groupId>org.ejml</groupId>
            <artifactId>ejml-all</artifactId>
            <version>0.35</version>
            <scope>test</scope>
        </dependency>

        <dependency> <!-- Unit Tests -->
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <!-- Build Process -->
    <build>

        <!-- Include the README, NOTICE and LICENSE files: -->
        <resources>
            <resource>
                <directory>${project.basedir}</directory>
                <includes>
                    <include>README*</include>
                    <include>NOTICE*</include>
                    <include>LICENSE*</include>
                    <include>CHANGELOG*</include>
                </includes>
            </resource>
        </resources>

        <plugins>

            <!-- Java 9 and later: compile in 2 stages so we can get a module-info w/ target sources -->
            <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>${matlab.target}</source>
                            <target>${matlab.target}</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>us.hebi.matlab.mat</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>verify</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>verify</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.7</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

        </plugins>
    </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>1.6</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>
