<?xml version="1.0" encoding="UTF-8"?>
<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>com.googlecode.blaisemath</groupId>
    <artifactId>coda</artifactId>
    <version>0.1.17</version>
    <packaging>pom</packaging>

    <modules>
        <module>coda-data</module>
        <module>coda-app</module>
<!--        <module>coda-jlink</module>-->
    </modules>

    <name>${project.artifactId}-${project.version}</name>
    <description>Time series analytics and visualization, with specialized tools for COVID-19 data processing and visualization.</description>
    <url>https://github.com/triathematician/covid-analytics</url>
    <inceptionYear>2020</inceptionYear>
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>ElishaPeterson</id>
            <name>Elisha Peterson</name>
            <email>triathematician+blaise@gmail.com</email>
            <url>https://github.com/triathematician</url>
            <organization>NA</organization>
            <organizationUrl>NA</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/triathematician/covid-analytics</url>
        <connection>scm:git:git://github.com/triathematician/covid-analytics.git</connection>
        <developerConnection>scm:git:git@github.com:triathematician/covid-analytics.git</developerConnection>
      <tag>coda-0.1.17</tag>
  </scm>
    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/triathematician/covid-analytics/issues</url>
    </issueManagement>
    <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>

    <properties>
        <kotlin.version>1.4.32</kotlin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- set license attributes for license plugin -->
        <license.organizationName>Elisha Peterson</license.organizationName>
        <license.licenseName>apache_v2</license.licenseName>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
	    <plugins>
            <!-- set kotlin version -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>11</jvmTarget>
                </configuration>
            </plugin>

            <!-- set minimum constraints on build environment -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.0.5</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>11</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- set sources and targets to Java 11 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>

            <!-- Automatically update file headers, and add license file to distribution -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>1.20</version>
                <configuration>
                    <roots>
                        <root>src/main/kotlin</root>
                        <root>src/test/kotlin</root>
                    </roots>
                    <canUpdateCopyright>true</canUpdateCopyright>
                    <sectionDelimiter>--</sectionDelimiter>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>update-project-license</goal>
                            <goal>update-file-header</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- override to customize release plugin options -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>perform</goal>
                        </goals>
                        <configuration>
                            <pomFileName>${project.name}/pom.xml</pomFileName>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

<!--            &lt;!&ndash; support for jlink &ndash;&gt;-->
<!--            <plugin>-->
<!--                <artifactId>maven-jlink-plugin</artifactId>-->
<!--                <version>3.1.0</version>-->
<!--                <extensions>true</extensions>-->
<!--                <configuration>-->
<!--                    &lt;!&ndash; configuration elements goes here &ndash;&gt;-->
<!--                </configuration>-->
<!--            </plugin>-->
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- this is for building sources & javadocs, signing, & deploying to staging repo -->
            <id>release</id>
            <build>
                <plugins>
                    <!-- build sources -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- build javadocs -->
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${kotlin.version}</version>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>dokka</goal>
                                    <goal>javadoc</goal>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- build javadocs -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- sign the artifacts with gpg (requires command-line utility) -->
                    <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>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- deploy to staging repo -->
                    <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://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>