<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <name>r5</name>
    <description>Next-generation fast routing library for spatial analysis applications</description>
    <url>https://github.com/conveyal/r5</url>

    <groupId>com.conveyal</groupId>
    <artifactId>r5</artifactId>
    <version>4.2.0</version>
    <packaging>jar</packaging>
    <licenses>
        <license>
            <name>MIT</name>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <!-- Developer entries are provided for primary developers.
   For other contributors, see https://github.com/conveyal/r5/graphs/contributors -->
    <developers>
        <developer>
            <name>Matt Conway</name>
            <email>mconway@conveyal.com</email>
            <organization>Conveyal</organization>
            <organizationUrl>http://conveyal.com/</organizationUrl>
        </developer>
        <developer>
            <name>Andrew Byrd</name>
            <email>abyrd@conveyal.com</email>
            <organization>Conveyal</organization>
            <organizationUrl>http://conveyal.com/</organizationUrl>
        </developer>
        <developer>
            <name>Marko Burjek</name>
            <email></email>
            <organization>Kodanta</organization>
        </developer>
    </developers>

    <!-- Define where the source code for this project lives -->
    <scm>
        <connection>scm:git:https://github.com/conveyal/r5.git</connection>
        <developerConnection>scm:git:https://github.com/conveyal/r5.git</developerConnection>
        <url>https://github.com/conveyal/r5</url>
    </scm>

    <!-- Define some variables to be used elsewhere in the build. -->
    <properties>
        <geotools.version>14.0</geotools.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <!-- Define where the artifacts produced by this build will be deployed -->
    <distributionManagement>
        <!-- We are using Sonatype Nexus Staging instead of Maven Release plugin.
             Only a snapshot repo should be configured. Releases are done from that snapshot staging repo. -->
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <build>

        <resources>
            <resource>
                <!-- Filtering means Maven will substitute some variables into files in the resources directory before
                    including them in the JAR. This allows Maven to substitute build details and version number
                    into a properties file, making them known to R5 at runtime. Some other files that server other
                    purposes are also listed for inclusion in the JAR. -->
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                    <include>worker.sh</include>
                    <include>debug-plan/**</include>
                    <include>fares/**</include>
                </includes>
            </resource>
        </resources>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <!-- use Java 8 -->
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.2</version>
                <!-- Create a version of the JAR that includes all dependencies.
                     We don't want this to be attached and deployed, but we'll have Travis upload it to S3. -->
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <!-- Name the shaded JAR after the git describe string. This makes it uniquely identifiable so we can
                                 run analysis workers with a specific commit or tag of R5. The shaded JAR is not "attached" to
                                 deployments because this will cause it to be renamed to the standard timestamped name and sorted
                                 into a Maven repo directory by version number. -->
                            <finalName>${git.commit.id.describe}</finalName>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Main-Class>com.conveyal.r5.R5Main</Main-Class>
                                        <!-- The ImageIO lines allow some image reader plugins to work see https://stackoverflow.com/questions/7051603/jai-vendorname-null#18495658 -->
                                        <Specification-Title>Java Advanced Imaging Image I/O Tools</Specification-Title>
                                        <Specification-Version>1.1</Specification-Version>
                                        <Specification-Vendor>Sun Microsystems, Inc.</Specification-Vendor>
                                        <Implementation-Title>com.sun.media.imageio</Implementation-Title>
                                        <Implementation-Version>1.1</Implementation-Version>
                                        <Implementation-Vendor>Sun Microsystems, Inc.</Implementation-Vendor>
                                        <Extension-Name>com.sun.media.imageio</Extension-Name>
                                    </manifestEntries>
                                </transformer>
                                <!-- files overwrite each other and geotools does not function without this.
                                     http://docs.geotools.org/latest/userguide/faq.html#how-do-i-create-an-executable-jar-for-my-geotools-app -->
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            </transformers>
                            <!-- signature files from included jars cause problems: http://stackoverflow.com/questions/999489 -->
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!-- Recommended way to deploy to OSSRH -->
                <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>
                    <!-- Release versions will be synced to Maven Central automatically. -->
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <plugin>
                <!-- Allow attaching Javadoc during releases -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <configuration>
                    <!-- Turn off Java 8 strict Javadoc checking -->
                    <additionalparam>-Xdoclint:none</additionalparam>
                    <tags>
                        <tag>
                            <name>notnull</name>
                            <placement>a</placement>
                            <head>Not null</head>
                        </tag>
                        <tag>
                            <name>default</name>
                            <placement>a</placement>
                            <head>Default:</head>
                        </tag>
                    </tags>
                </configuration>
                <executions>
                    <!-- Compress Javadoc into JAR and include that JAR when deploying. -->
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!-- Include zipped source code in releases -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <!-- We sign in the verify phase, which means it will happen before install and deploy (the last two phases)
                             but not before earlier phases like test or package. -->
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <!-- Hack to force maven to check central first. Maven central is inherited from the superpom,
             but ends up at the end of the list. Though most of the time the artifact is in central,
             Maven tries to download from every other repository and fails before checking central.
             Do not change the id from central2 to central, otherwise the entry will be ignored. -->
        <repository>
            <id>central2</id>
            <name>check central first to avoid a lot of not found warnings</name>
            <url>https://repo1.maven.org/maven2</url>
        </repository>
        <repository>
            <id>conveyal</id>
            <name>conveyal</name>
            <url>https://maven.conveyal.com</url>
        </repository>
        <repository>
            <id>conveyal-ossrh</id>
            <name>releases on sonatype, which may not yet have been synced with central</name>
            <url>https://oss.sonatype.org/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>osgeo</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>http://download.osgeo.org/webdav/geotools/</url>
        </repository>
        <!-- Needed  for graphql-java-->
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>bintray-andimarek-graphql-java</id>
            <name>bintray</name>
            <url>https://dl.bintray.com/andimarek/graphql-java</url>
        </repository>
    </repositories>

    <dependencies>
        <!-- Jackson provides fast streaming JSON (de)serialization of Java objects. -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.6.1</version>
        </dependency>
        <!-- JTS does 2D geometry and topology. Recently moved from vividsolutions to locationtech.
          We could update R5 to use the new locationtech class names and its built-in GeoJSON support.
          However, Geotools still depends on vividsolution JTS so this might be complicated. -->
        <dependency>
            <groupId>com.vividsolutions</groupId>
            <artifactId>jts</artifactId>
            <version>1.13</version>
        </dependency>
        <dependency>
            <groupId>de.grundid.opendatalab</groupId>
            <artifactId>geojson-jackson</artifactId>
            <version>1.5</version>
        </dependency>
        <!-- Trove provides optimized map/set collections for native types (int, long...) -->
        <dependency>
            <groupId>net.sf.trove4j</groupId>
            <artifactId>trove4j</artifactId>
            <version>3.0.3</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.javacsv</groupId>
            <artifactId>javacsv</artifactId>
            <version>2.0</version>
        </dependency>
        <!-- GeoTools is a free software GIS toolkit. -->
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-opengis</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-api</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-shapefile</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-epsg-hsql</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-referencing</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-coverage</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-geojson</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-geotiff</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.0</version>
        </dependency>
        <!-- Guava is a set of core libraries that includes new collection types, among other things. -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>24.0-jre</version>
        </dependency>
        <!-- Conveyal library for loading and storing GTFS transit data. -->
        <dependency>
            <groupId>com.conveyal</groupId>
            <artifactId>gtfs-lib</artifactId>
            <version>3.0.6</version>
        </dependency>
        <!-- Conveyal library for loading and storing OSM road data. -->
        <dependency>
            <groupId>com.conveyal</groupId>
            <artifactId>osm-lib</artifactId>
            <version>1.4.0</version>
        </dependency>
        <!-- Fast serialization, used to save transport networks to disk (with some mmap hacks). -->
        <dependency>
            <groupId>de.ruedigermoeller</groupId>
            <artifactId>fst</artifactId>
            <version>2.56</version>
        </dependency>
        <!-- Logging API. -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <!-- Logging API implementation. -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        <!-- Junit is for unit testing. -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.graphql-java</groupId>
            <artifactId>graphql-java</artifactId>
            <version>2016-02-19T11-51-00</version>
        </dependency>
        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.7.1</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.conveyal</groupId>
            <artifactId>jackson2-geojson</artifactId>
            <version>0.8</version>
        </dependency>
        <dependency>
            <groupId>com.axiomalaska</groupId>
            <artifactId>polyline-encoder</artifactId>
            <version>0.1</version>
        </dependency>
    </dependencies>
</project>
