<?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>

  <!-- GAV -->
  <groupId>io.github.jean-francois-baget</groupId>
  <artifactId>nanoparse</artifactId>
  <version>0.1.0</version>
  <packaging>jar</packaging>

  <name>NanoParse</name>
  <description>A tiny parser-combinator-style library for Java.</description>
  <url>https://github.com/Jean-Francois-Baget/nanoparse</url>

  <!-- License (change if you prefer MIT or something else) -->
  <licenses>
    <license>
      <name>Apache License 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <!-- SCM info for Maven Central -->
  <scm>
    <url>https://github.com/Jean-Francois-Baget/nanoparse</url>
    <connection>scm:git:git://github.com/Jean-Francois-Baget/nanoparse.git</connection>
    <developerConnection>scm:git:ssh://github.com/Jean-Francois-Baget/nanoparse.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <developers>
    <developer>
      <id>jfbaget</id>
      <name>Jean-François Baget</name>
      <email>baget@lirmm.fr</email>
      <url>https://www.lirmm.fr/~baget/</url>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- choose your baseline; 17 is fine if you want modern-only -->
    <maven.compiler.release>17</maven.compiler.release>
    <junit.jupiter.version>5.11.0</junit.jupiter.version>
  </properties>

  <dependencies>
    <!-- JUnit 5 for tests -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>

    <!-- JSON for IMatch.toJSON(). Public dependency, not optional. -->
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20220320</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Compile with chosen Java release -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.13.0</version>
        <configuration>
          <release>${maven.compiler.release}</release>
        </configuration>
      </plugin>

      <!-- JUnit 5 → Surefire 3.x is fine out of the box -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.3.0</version>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>release</id>

      <build>
        <plugins>
          <!-- Attach -sources.jar for Central -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.3.0</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Attach -javadoc.jar for Central -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.6.3</version>
            <configuration>
              <!-- Turn off strict doclint errors (JDK8+) -->
              <doclint>none</doclint>
              <!-- Never fail the build because of javadoc issues -->
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Sign all artifacts -->
          <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>

          <!-- Publish to Central Portal -->
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.9.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <!-- optional: publish automatically after validation -->
              <!-- <autoPublish>true</autoPublish> -->
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>
  </profiles>

</project>