<?xml version="1.0" encoding="UTF-8"?>

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<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>
  <parent>
    <groupId>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform-export-pdf</artifactId>
    <version>14.10.7</version>
  </parent>
  <artifactId>xwiki-platform-export-pdf-default</artifactId>
  <name>XWiki Platform - Export - PDF - Default</name>
  <packaging>jar</packaging>
  <description>Default implementation of the API for multipage PDF export using a headless Chrome browser running inside a Docker container.</description>
  <properties>
    <!-- Name to display by the Extension Manager -->
    <xwiki.extension.name>PDF Export Default API Implementation</xwiki.extension.name>
    <xwiki.jacoco.instructionRatio>0.70</xwiki.jacoco.instructionRatio>
    <!-- This extension needs to be installed on the root namespace because it uses a configuration source,
      PDFExportConfigurationSource, that uses a fixed cache id so it doesn't allow multiple instances (e.g. one per
      wiki). We could change the implementation to use a dynamic cache id based on the namespace where the configuration
      source is installed, but it's not worth the effort. -->
    <xwiki.extension.namespaces>{root}</xwiki.extension.namespaces>
  </properties>
  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>xwiki-platform-export-pdf-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>xwiki-platform-oldcore</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- Used to record required skin extensions while rendering documents. -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>xwiki-platform-skin-skinx</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- Used to implement the configuration source. -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>xwiki-platform-configuration-default</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
    </dependency>
    <!-- Used for running a headless Chrome web browser inside a Docker container. -->
    <dependency>
      <groupId>com.github.docker-java</groupId>
      <artifactId>docker-java-core</artifactId>
    </dependency>
    <!-- Required by docker-java-core -->
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcpkix-jdk18on</artifactId>
    </dependency>
    <dependency>
      <groupId>com.github.docker-java</groupId>
      <artifactId>docker-java-transport-httpclient5</artifactId>
    </dependency>
    <!-- Starting with version 5.2 org.apache.httpcomponents.client5:httpclient5 uses the HttpVersionPolicy class from
      org.apache.httpcomponents.core5:httpcore5-h2 . The problem is that docker-java-transport-httpclient5 excludes
      httpcore5-h2, see https://github.com/docker-java/docker-java/blob/3.2.13/docker-java-transport-httpclient5/pom.xml#L29-L34
      which leads to a NoClassDefFoundError. In order to fix this we add an explicit dependency to httpclient5 (note that
      depending on httpcore5-h2 doesn't fix the problem because Extension Manager still favors the exclude; we need to
      overwrite the dependency used by docker-java-transport-httpclient5 which is httpclient5).
      TODO: Remove this dependency when docker-java-transport-httpclient5 POM is fixed and we upgrade DockerJava version -->
    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
    </dependency>
    <!-- Used for interacting with the headless Chrome web browser. -->
    <dependency>
      <groupId>com.github.kklisura.cdt</groupId>
      <artifactId>cdt-java-client</artifactId>
      <version>4.0.0</version>
      <exclusions>
        <!-- Chrome Developer Tools Java client depends on WebSocket API 1.1 which we can't use yet because we support
          an older version of Jetty (9.4.x). Fortunately, it seems that the code is compatible with the WebSocket API
          1.0 version that comes from our parent POM so we can force it for now. -->
        <exclusion>
          <groupId>javax.websocket</groupId>
          <artifactId>javax.websocket-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- Replaces the 1.1 version coming as transitive dependency of cdt-java-client, see above. -->
    <dependency>
      <groupId>javax.websocket</groupId>
      <artifactId>javax.websocket-api</artifactId>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-tool-test-component</artifactId>
      <version>${commons.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
