<?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>

  <groupId>io.xberg</groupId>
  <artifactId>html-to-markdown</artifactId>
  <version>3.10.0</version>
  <packaging>jar</packaging>

  <name>html-to-markdown</name>
  <description>High-performance HTML to Markdown converter</description>
  <url>https://github.com/xberg-io/html-to-markdown</url>

  <licenses>
    <license>
      <name>MIT</name>
      <url>https://opensource.org/licenses/MIT</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Na&apos;aman Hirschfeld</name>
      <email>naaman@xberg.io</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/xberg-io/html-to-markdown.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/xberg-io/html-to-markdown.git</developerConnection>
    <url>https://github.com/xberg-io/html-to-markdown</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>25</maven.compiler.release>
    <junit.version>6.1.2</junit.version>
    <maven.version>3.6.3</maven.version>
    <maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
    <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
    <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
    <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
    <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
    <maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
    <maven-resources-plugin.version>3.5.0</maven-resources-plugin.version>
    <maven-jar-plugin.version>3.5.1</maven-jar-plugin.version>
    <maven-install-plugin.version>3.1.4</maven-install-plugin.version>
    <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
    <maven-site-plugin.version>4.0.0-M16</maven-site-plugin.version>
    <central-publishing-plugin.version>0.11.0</central-publishing-plugin.version>
    <versions-maven-plugin.version>2.21.0</versions-maven-plugin.version>
    <maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
    <jacoco-maven-plugin.version>0.8.15</jacoco-maven-plugin.version>
    <checkstyle.version>13.9.0</checkstyle.version>
    <gpg.skip>true</gpg.skip>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.jspecify</groupId>
      <artifactId>jspecify</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.22.1</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jdk8</artifactId>
      <version>2.22.1</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>4.0.0-M1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <!-- The alef Java backend emits source files at the package root
             (e.g. packages/java/io/<group>/<artifact>/Foo.java), not
             under the Maven-default `src/main/java/` layout. Point sourceDirectory
             at the package root so `mvn package` finds them. -->
    <sourceDirectory>${project.basedir}</sourceDirectory>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven-clean-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven-resources-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven-install-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven-deploy-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven-site-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <release>25</release>
          <compilerArgs>
            <arg>--enable-preview</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <argLine>@{argLine} -XX:-ClassUnloading -XX:-ClassUnloadingWithConcurrentMark --enable-native-access=ALL-UNNAMED --enable-preview -Djava.library.path=${project.basedir}/../../target/release</argLine>
          <forkedProcessExitTimeoutInSeconds>600</forkedProcessExitTimeoutInSeconds>
          <parallel>classes</parallel>
          <threadCount>4</threadCount>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <configuration>
          <!-- Bind the ${classifier} property so native JARs are emitted
                         with the correct classifier (e.g. osx-aarch64, linux-x64, …).
                         When CI runs `mvn package -Dclassifier=osx-aarch64`, Maven
                         passes the classifier through to this configuration, allowing
                         the JAR to be published as example-language-pack-java-1.9.0-osx-aarch64.jar
                         instead of example-language-pack-java-1.9.0.jar. -->
          <classifier>${classifier}</classifier>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${maven-source-plugin.version}</version>
        <configuration>
          <!-- sourceDirectory is the project basedir, so the default
                         source-archive include of everything under basedir
                         pulls in target/ as well (which contains the archive
                         being assembled — "A zip file cannot include itself").
                         Restrict to the alef-emitted io/ subtree and
                         any conventional `src/main/java/` overlay. -->
          <includes>
            <include>io/**/*.java</include>
            <include>src/main/java/**/*.java</include>
          </includes>
        </configuration>
        <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>${maven-javadoc-plugin.version}</version>
        <configuration>
          <doclint>all,-missing</doclint>
          <failOnWarning>true</failOnWarning>
          <show>protected</show>
          <additionalOptions>--enable-preview</additionalOptions>
          <!-- sourcepath MUST match <sourceDirectory> above (which is
                         ${project.basedir} for the flat layout alef emits) — the
                         Maven-default `src/main/java/` does not exist in our tree,
                         so attach-javadocs found no sources and skipped jar
                         creation, which Sonatype Central rejected as
                         "Javadocs must be provided but not found in entries". -->
          <sourcepath>${project.basedir}</sourcepath>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${maven-enforcer-plugin.version}</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>${maven.version}</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>${project.basedir}/checkstyle.xml</configLocation>
          <propertiesLocation>${project.basedir}/checkstyle.properties</propertiesLocation>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <violationSeverity>warning</violationSeverity>
          <propertyExpansion>config_loc=${project.basedir}</propertyExpansion>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>${versions-maven-plugin.version}</version>
        <configuration>
          <generateBackupPoms>false</generateBackupPoms>
          <rulesUri>file://${project.basedir}/versions-rules.xml</rulesUri>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>java/**/*</exclude>
            <exclude>sun/**/*</exclude>
            <exclude>jdk/**/*</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>${maven-gpg-plugin.version}</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>publish</id>
      <properties>
        <gpg.skip>false</gpg.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <passphraseEnvName>MAVEN_GPG_PASSPHRASE</passphraseEnvName>
                  <gpgArguments>
                    <arg>--batch</arg>
                    <arg>--yes</arg>
                    <arg>--pinentry-mode=loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>${central-publishing-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>ossrh</publishingServerId>
              <autoPublish>true</autoPublish>
              <waitUntil>validated</waitUntil>
              <waitMaxTime>7200</waitMaxTime>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
