<?xml version="1.0" encoding="UTF-8"?>

<!--
  Licensed under the Apache License, Version 2.0 (the "License").
  See the NOTICE file distributed with this work for additional
  information regarding copyright ownership. You may not use this
  file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>tech.uom</groupId>
    <artifactId>uom-parent</artifactId>
    <version>2.1.1</version>
  </parent>



  <!-- ==============================================================
         Project description. The <organization> and <licenses>
         elements override the ones defined in parent pom.xml.
       ============================================================== -->
  <groupId>tech.uom</groupId>
  <artifactId>seshat</artifactId>
  <version>1.0</version>

  <name>Seshat Units of Measurement Implementation</name>
  <url>https://github.com/unitsofmeasurement/seshat</url>
  <description>
    Seshat (from the ancient Egyptian goddess of knowledge, writing and surveying)
    is an implementation of Units of Measurement API defined by JSR 363. Seshat is
    a subset of Apache Spatial Information System (SIS) library keeping only the
    classes required for JSR 363, with geospatial-specific functionalities omitted.
  </description>
  <inceptionYear>2018</inceptionYear>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>



  <!-- ==============================================================
         Source code repository, issue managements and mailing lists.
       ============================================================== -->
  <scm>
    <connection>scm:git:https://github.com/unitsofmeasurement/seshat.git</connection>
    <developerConnection>scm:git:https://github.com/unitsofmeasurement/seshat.git</developerConnection>
    <url>https://github.com/unitsofmeasurement/seshat</url>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/unitsofmeasurement/seshat/issues</url>
  </issueManagement>



  <!-- ==============================================================
         Developers and Contributors.
       ============================================================== -->
  <developers>
    <developer>
      <name>Martin Desruisseaux</name>
      <id>desruisseaux</id>
      <email>desruisseaux@apache.org</email>
      <organization>Geomatys</organization>
      <organizationUrl>http://www.geomatys.com</organizationUrl>
      <timezone>+1</timezone>
      <roles>
        <role>Java developer</role>
      </roles>
    </developer>
  </developers>
  <contributors>
    <contributor>
      <name>Werner Keil</name>
      <email>werner@catmedia.us</email>
      <organization>Creative Arts &amp; Technologies</organization>
      <organizationUrl>http://www.catmedia.us</organizationUrl>
      <timezone>+1</timezone>
      <roles>
        <role>Administrator</role>
      </roles>
    </contributor>
  </contributors>



  <!-- ===========================================================
           Dependencies, some of them defined by properties.
       =========================================================== -->
  <dependencies>
    <dependency>
      <groupId>javax.measure</groupId>
      <artifactId>unit-api</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>tech.units</groupId>
      <artifactId>unit-tck</artifactId>
      <version>1.1</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>     <!-- Avoid possible interference with the implementation under test -->
          <groupId>tec.units</groupId>
          <artifactId>unit-ri</artifactId>
        </exclusion>
        <exclusion>     <!-- MutabilityDetector uses an older version than the one inherited from JUnit. -->
          <groupId>org.hamcrest</groupId>
          <artifactId>hamcrest-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <properties>
    <jsr.version>1.0</jsr.version>
    <maven.compile.sourceLevel>8</maven.compile.sourceLevel>
    <maven.compile.targetLevel>8</maven.compile.targetLevel>
    <maven.surefire.version>3.0.0-M5</maven.surefire.version>
    <next.java.version>10</next.java.version>
  </properties>



  <!-- ==============================================================
         Build configuration.
         See http://maven.apache.org/plugins/ for a plugins list.
       ============================================================== -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce</id>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>${next.java.version}</version>
                </requireJavaVersion>
                <dependencyConvergence/>
              </rules>
            </configuration>
            <goals>
              <goal>enforce</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- Compile properties files into resources UTF files. -->
        <groupId>org.apache.sis.core</groupId>
        <artifactId>sis-build-helper</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <goals>
              <goal>compile-resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <debug>false</debug>
          <verbose>false</verbose>
          <compilerArgs>
            <arg>-Xlint:all</arg>
            <arg>-Xdoclint:all</arg>
          </compilerArgs>
          <compilerArgument>-g:lines</compilerArgument> <!-- Override parent pom.xml configuration. -->
          <useIncrementalCompilation>false</useIncrementalCompilation> <!-- https://jira.codehaus.org/browse/MCOMPILER-209 -->
          <release>${maven.compile.targetLevel}</release>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals><goal>run</goal></goals>
            <configuration>
              <target>
                <mkdir dir       = "${project.build.directory}/classes/META-INF/versions/${next.java.version}"/>
                <javac destdir   = "${project.build.directory}/classes/META-INF/versions/${next.java.version}"
                       srcdir    = "${project.basedir}/src/main/java_${next.java.version}"
                       encoding  = "${project.build.sourceEncoding}"
                       includeAntRuntime = "false">

                    <!-- TODO: use release attribute instead after next plugin release.
                         https://issues.apache.org/jira/browse/MANTRUN-214 -->
                    <compilerarg line="--release=${next.java.version} --module-path=${javax.measure:unit-api:jar} --patch-module tech.uom.seshat=${project.build.directory}/classes"/>
                </javac>
                <move file="${project.build.directory}/classes/META-INF/versions/${next.java.version}/module-info.class"
                    tofile="${project.build.directory}/classes/module-info.class"/>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <testNGArtifactName>none:none</testNGArtifactName>    <!-- Disable TestNG runner as we use JUnit instead. -->
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <addMavenDescriptor>false</addMavenDescriptor>
            <index>false</index>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathLayoutType>simple</classpathLayoutType>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Built-On>${maven.build.timestamp}</Built-On>
              <Specification-Title>JSR 363</Specification-Title>
              <Specification-Version>${jsr.version}</Specification-Version>
              <Specification-Vendor>Java Community Process</Specification-Vendor>
              <Implementation-URL>https://github.com/unitsofmeasurement/seshat</Implementation-URL>
              <Automatic-Module-Name>tech.uom.seshat</Automatic-Module-Name>
            </manifestEntries>
          </archive>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <skip>true</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <source>${maven.compile.sourceLevel}</source>
          <encoding>${project.build.sourceEncoding}</encoding>
          <docencoding>${project.build.sourceEncoding}</docencoding>
          <charset>${project.build.sourceEncoding}</charset>
          <locale>en</locale>
          <author>false</author>
          <version>false</version>
          <noqualifier>all</noqualifier>
          <quiet>true</quiet>
          <keywords>true</keywords>
          <breakiterator>true</breakiterator>
          <validateLinks>true</validateLinks>
          <failOnError>true</failOnError>
          <additionalOptions>--add-stylesheet "${basedir}/src/main/javadoc/sis.css</additionalOptions>
          <verbose>false</verbose>
          <links>
            <link>https://unitsofmeasurement.github.io/unit-api/site/apidocs</link>
          </links>
          <excludePackageNames>tech.uom.seshat.*</excludePackageNames>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <gpgArguments>
                <arg>--digest-algo=SHA512</arg>
              </gpgArguments>
              <keyname>D89EF3A674383E9D</keyname>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
