<?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>
  <name>jsoup Java HTML Parser</name>

  <groupId>org.jsoup</groupId>
  <artifactId>jsoup</artifactId>
  <version>1.17.2</version><!-- remember to update previous version below for japicmp -->
  <url>https://jsoup.org/</url>
  <description>jsoup is a Java library that simplifies working with real-world HTML and XML. It offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM API methods, CSS, and xpath selectors. jsoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers.</description>
  <inceptionYear>2009</inceptionYear>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/jhy/jsoup/issues</url>
  </issueManagement>
  <licenses>
    <license>
      <name>The MIT License</name>
      <url>https://jsoup.org/license</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>https://github.com/jhy/jsoup</url>
    <connection>scm:git:https://github.com/jhy/jsoup.git</connection>
    <!-- <developerConnection>scm:git:git@github.com:jhy/jsoup.git</developerConnection> -->
    <tag>jsoup-1.17.2</tag>
  </scm>
  <organization>
    <name>Jonathan Hedley</name>
    <url>https://jhy.io/</url>
  </organization>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jetty.version>9.4.53.v20231009</jetty.version>
  </properties>

  <build>
    <plugins>
      <!-- Compile -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.12.1</version>
        <configuration>
          <encoding>UTF-8</encoding>
          <compilerArgs>
            <!-- saves output for package-info.java, so mvn sees it has completed it, so incremental compile works -->
            <arg>-Xpkginfo:always</arg>
          </compilerArgs>
          <!-- this means incremental = true... -->
          <useIncrementalCompilation>false</useIncrementalCompilation>
        </configuration>
        <executions>
          <execution>
            <id>compile-java-8</id>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </execution>
          <!-- There is a JDK 9+ profile execution below, which adds multi-release=true and compiles module-info -->
        </executions>
      </plugin>

      <!-- Ensure Java 8 and Android 10 API compatibility -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <version>1.23</version>
        <executions>
          <execution>
            <id>animal-sniffer</id>
            <phase>compile</phase>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <signature>
                <groupId>org.codehaus.mojo.signature</groupId>
                <artifactId>java18</artifactId>
                <version>1.0</version>
              </signature>
              <signature>
                <groupId>net.sf.androidscents.signature</groupId>
                <artifactId>android-api-level-10</artifactId>
                <version>2.3.3_r2</version>
              </signature>
              <ignores>
                <ignore>java.util.function.*</ignore>
                <ignore>java.util.stream.*</ignore>
                <ignore>java.lang.ThreadLocal</ignore>
                <ignore>java.io.UncheckedIOException</ignore>
                <ignore>java.util.List</ignore> <!-- List#stream() -->
                <ignore>java.util.Objects</ignore>
                <ignore>java.util.Optional</ignore>
                <ignore>java.util.Spliterator</ignore>
                <ignore>java.util.Spliterators</ignore>

                <ignore>java.net.HttpURLConnection</ignore><!-- .setAuthenticator(java.net.Authenticator) in Java 9; only used in multirelease 9+ version -->
              </ignores>
              <!-- ^ Provided by https://developer.android.com/studio/write/java8-support#library-desugaring
               Possibly OK to remove androidscents; keep for now to validate other additions are supported. -->
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.6.3</version>
        <configuration>
          <doclint>none</doclint>
          <source>8</source>
          <linksource>true</linksource>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadoc</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <excludes>
            <exclude>org/jsoup/examples/**</exclude>
          </excludes>
        </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-jar-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Multi-Release>true</Multi-Release>
            </manifestEntries>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
          <excludes>
            <exclude>org/jsoup/examples/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>5.1.9</version>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <instructions>
            <Bundle-DocURL>https://jsoup.org/</Bundle-DocURL>
            <Export-Package>org.jsoup.*</Export-Package>
            <Import-Package>org.jspecify.annotations;version=!;resolution:=optional,*</Import-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.2.3</version>
        <configuration>
          <!-- smaller stack to find stack overflows -->
          <argLine>-Xss256k</argLine>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.2.3</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <parallel>methods</parallel>
          <threadCount>8</threadCount>
        </configuration>
      </plugin>
      <plugin>
        <!-- API version compat check - https://siom79.github.io/japicmp/ -->
        <groupId>com.github.siom79.japicmp</groupId>
        <artifactId>japicmp-maven-plugin</artifactId>
        <version>0.18.3</version>
        <configuration>
          <!-- hard code previous version; can't detect when running stateless on build server -->
          <oldVersion>
            <dependency>
              <groupId>org.jsoup</groupId>
              <artifactId>jsoup</artifactId>
              <version>1.16.2</version>
              <type>jar</type>
            </dependency>
          </oldVersion>
          <parameter>
            <!-- jsoup policy is ok to remove deprecated methods on minor but not builds. will need to temp remove on bump to 1.15.1 and manually validate -->
            <onlyModified>false</onlyModified>
            <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
            <breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
            <excludes>
              <!-- <exclude>@java.lang.Deprecated</exclude> -->
            </excludes>
            <overrideCompatibilityChangeParameters>
              <!-- allows new default and move to default methods. compatible as long as existing binaries aren't making calls via reflection. if so, they need to catch errors anyway. -->
              <overrideCompatibilityChangeParameter>
                <compatibilityChange>METHOD_NEW_DEFAULT</compatibilityChange>
                <binaryCompatible>true</binaryCompatible>
                <sourceCompatible>true</sourceCompatible>
              </overrideCompatibilityChangeParameter>
              <overrideCompatibilityChangeParameter>
                <compatibilityChange>METHOD_ABSTRACT_NOW_DEFAULT</compatibilityChange>
                <binaryCompatible>true</binaryCompatible>
                <sourceCompatible>true</sourceCompatible>
              </overrideCompatibilityChangeParameter>

              <!--
                One off, getting a spurious ping on adding [<T extends Node> Stream<T> nodeStream(Class<T> class)] to Node.
                Manually verified binary & source compatibility
                todo: remove after 1.17.1 release
               -->
              <overrideCompatibilityChangeParameter>
                <compatibilityChange>CLASS_GENERIC_TEMPLATE_CHANGED</compatibilityChange>
                <binaryCompatible>true</binaryCompatible>
                <sourceCompatible>true</sourceCompatible>
              </overrideCompatibilityChangeParameter>

            </overrideCompatibilityChangeParameters>
          </parameter>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>cmp</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>./</directory>
        <targetPath>META-INF/</targetPath>
        <filtering>false</filtering>
        <includes>
          <include>LICENSE</include>
          <include>README.md</include>
          <include>CHANGES</include>
        </includes>
      </resource>
    </resources>
  </build>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <profiles>
    <!-- Compiles the multi-release jar when executed on JDK9+ -->
    <profile>
      <id>compile-multi-release</id>
      <activation>
        <jdk>[9,2000)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <id>compile-java-8</id>
                <configuration>
                  <release>8</release>
                </configuration>
              </execution>
              <execution>
                <id>compile-java-9</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <release>9</release>
                  <compileSourceRoots>
                    <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
                  </compileSourceRoots>
                  <multiReleaseOutput>true</multiReleaseOutput>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>package</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>failsafe</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.2.3</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>

    <!-- junit -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.10.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- gson, to fetch entities from w3.org -->
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.10.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- jetty for webserver integration tests. 9.x is last with Java7 support -->
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- jetty for webserver integration tests -->
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- jetty proxy, for integration tests -->
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-proxy</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- org.jspecify.annotations.nonnull, with Apache 2 license. Build time only. -->
      <groupId>org.jspecify</groupId>
      <artifactId>jspecify</artifactId>
      <version>0.3.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
    </dependencies>
  </dependencyManagement>

  <developers>
    <developer>
      <id>jhy</id>
      <name>Jonathan Hedley</name>
      <email>jonathan@hedley.net</email>
      <roles>
        <role>Lead Developer</role>
      </roles>
      <timezone>+11</timezone>
    </developer>
  </developers>

</project>
