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

<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); 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>org.apache.sis</groupId>
    <artifactId>non-free</artifactId>
    <version>1.0</version>
  </parent>


  <!-- ===========================================================
           Module description, including licenses information
       =========================================================== -->
  <groupId>org.apache.sis.non-free</groupId>
  <artifactId>sis-embedded-data</artifactId>

  <name>Data in embedded environment</name>
  <url>http://sis.apache.org/epsg</url>
  <description>
Provides non-free data, including the EPSG geodetic dataset, in a single read-only JAR file.
 This 'sis-embedded-data' module contains a copy of EPSG geodetic dataset in an embedded Apache Derby database.
 Having this module on the classpath avoid the need to set the 'SIS_DATA' environment variable
 for using the Coordinate Reference Systems (CRS) and Coordinate Operations defined by EPSG.
 EPSG is maintained by the IOGP Surveying &amp; Positioning Committee and reproduced in this module
 with same content. See http://www.epsg.org/ for more information.
  </description>

  <licenses>
    <license>
      <name>EPSG terms of use</name>
      <url>http://www.epsg.org/TermsOfUse</url>
      <distribution>manual</distribution>
    </license>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>


  <!-- ===========================================================
           Developers and Contributors
       =========================================================== -->
  <developers>
    <developer>
      <name>Martin Desruisseaux</name>
      <id>desruisseaux</id>
      <email>martin.desruisseaux@geomatys.com</email>
      <organization>Geomatys</organization>
      <organizationUrl>http://www.geomatys.com/</organizationUrl>
      <timezone>+1</timezone>
      <roles>
        <role>Module Maintainer</role>
        <role>Java Developer</role>
      </roles>
    </developer>
  </developers>

  <dependencies>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <scope>compile</scope>
    </dependency>
  </dependencies>


  <!-- ===========================================================
           Build configuration
       =========================================================== -->
  <build>
    <plugins>
      <!--
        Launches the database generator program at build time, after compilation.
        This program needs the 'sis-epsg' module to be checked out together with
        this 'sis-embedded-data' module. The database will be created directly in
        the 'target/classes' directory, and license files will be copied there.
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <id>create-database</id>
            <phase>process-classes</phase>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <executable>java</executable>
          <arguments>
            <argument>-classpath</argument> <classpath/>
            <argument>-Dderby.stream.error.file=${project.build.directory}/derby.log</argument>
            <argument>org.apache.sis.resources.embedded.Generator</argument>
          </arguments>
        </configuration>
      </plugin>

      <!-- Exclude from the JAR file the classes used for generating the database. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <include>**/Generator*</include>
          </excludes>
          <!-- Anticipation for Java 9 -->
          <archive>
            <manifestEntries>
              <Automatic-Module-Name>
                org.apache.sis.referencing.database
              </Automatic-Module-Name>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <!-- Unset the SIS_DATA environment variable for preventing
           it from taking precedence over the embedded data. -->
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <environmentVariables>
            <SIS_DATA></SIS_DATA>
          </environmentVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
