<!--
  ~ SPDX-License-Identifier: Apache-2.0
  ~ Copyright (C) 2018 National Library of Australia and the jwarc contributors
  -->

<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>org.netpreserve</groupId>
    <artifactId>jwarc</artifactId>
    <version>0.32.0</version>

    <name>jwarc</name>
    <description>Java library for reading and writing WARC files with a typed API</description>
    <url>https://github.com/iipc/jwarc</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/iipc/jwarc</url>
        <connection>scm:git:git@github.com:iipc/jwarc.git</connection>
        <developerConnection>scm:git:git@github.com:iipc/jwarc.git</developerConnection>
      <tag>v0.32.0</tag>
  </scm>

    <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <testSourceDirectory>${basedir}/test</testSourceDirectory>
        <resources>
            <resource>
                <directory>${basedir}/resources</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>${basedir}/test-resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.netpreserve.jwarc.tools.WarcTool</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.brotli</groupId>
          <artifactId>dec</artifactId>
          <version>0.1.2</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <developers>
        <developer>
            <name>Alex Osborne</name>
            <email>aosborne@nla.gov.au</email>
            <organization>National Library of Australia</organization>
            <organizationUrl>https://www.nla.gov.au/</organizationUrl>
        </developer>
    </developers>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <tagNameFormat>v@{version}</tagNameFormat>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.8.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <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-javadoc-plugin</artifactId>
                        <version>3.11.2</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- When running a build compiled with jdk9+ on jdk8 we need to set the -release 8 javac option to avoid
                java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
             However javac 8 itself doesn't understand the -release option so we have to do so conditionally -->
        <profile>
            <id>jdk9-plus</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <properties>
                <maven.compiler.release>8</maven.compiler.release>
            </properties>
        </profile>
    </profiles>

</project>
