<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <groupId>org.apache.tika</groupId>
    <artifactId>tika-pipes</artifactId>
    <version>4.1.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>tika-pipes-plugins</artifactId>
  <name>Apache Tika Plugins</name>
  <url>https://tika.apache.org/</url>
  <packaging>pom</packaging>

  <modules>
    <module>tika-pipes-atlassian-jwt</module>
    <module>tika-pipes-az-blob</module>
    <module>tika-pipes-csv</module>
    <module>tika-pipes-file-system</module>
    <module>tika-pipes-gcs</module>
    <module>tika-pipes-google-drive</module>
    <module>tika-pipes-http</module>
    <module>tika-pipes-jdbc</module>
    <module>tika-pipes-json</module>
    <module>tika-pipes-kafka</module>
    <module>tika-pipes-microsoft-graph</module>
    <module>tika-pipes-es</module>
    <module>tika-pipes-opensearch</module>
    <module>tika-pipes-s3</module>
    <module>tika-pipes-solr</module>
  </modules>

  <dependencies>
    <dependency>
      <groupId>org.pf4j</groupId>
      <artifactId>pf4j</artifactId>
      <!-- !!! VERY IMPORTANT -->
      <scope>provided</scope>
    </dependency>
    <!-- provided: bundling the plugin/host boundary yields duplicate Class objects -->
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-pipes-api</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>tika-core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-plugins-core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-serialization</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <!-- parent-loaded: on every host via tika-pipes-core; bundling duplicates PipesIteratorBase -->
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-pipes-iterator-commons</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <!-- host-supplied via tika-serialization: a plugin that bundles its own Jackson gets a
         second ObjectMapper class, and any mapper crossing the plugin boundary fails to link -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- logging is host-supplied -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-core</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-pipes-core</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <!-- plugin.properties carries the release version; everything else must stay unfiltered
           so config examples keep their literal ${...} placeholders. -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>plugin.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>plugin.properties</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <!-- A plugin's lib/ is its runtime-scope dependencies; a logging jar there puts a
           second SLF4J binding on the plugin classloader. Anything from these groups that
           arrives transitively must be declared provided (see the parent's dependencies). -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>ban-bundled-logging</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <excludes>
                    <exclude>org.slf4j</exclude>
                    <exclude>org.apache.logging.log4j</exclude>
                    <exclude>com.fasterxml.jackson.core</exclude>
                  </excludes>
                  <!-- the artifacts this module declares provided; anything else in these
                       groups needs a provided declaration here before it may be depended on -->
                  <includes>
                    <include>org.slf4j:slf4j-api</include>
                    <include>org.slf4j:jcl-over-slf4j</include>
                    <include>org.apache.logging.log4j:log4j-api</include>
                    <include>org.apache.logging.log4j:log4j-core</include>
                    <include>org.apache.logging.log4j:log4j-slf4j2-impl</include>
                    <include>com.fasterxml.jackson.core:jackson-core</include>
                    <include>com.fasterxml.jackson.core:jackson-databind</include>
                    <include>com.fasterxml.jackson.core:jackson-annotations</include>
                  </includes>
                  <message>logging and Jackson are host-supplied: add a provided-scope declaration in tika-pipes-plugins/pom.xml (and to this rule's include list) rather than bundling this artifact in the plugin zip. A plugin whose SDK genuinely needs its own Jackson may bundle it (compile scope, skip this execution in its pom) but must then use no host Jackson type -- not PluginJson -- since the two ObjectMapper classes cannot be assigned to each other.</message>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <inputExcludes>
            <inputExclude>tika-emitter-fs/target/**</inputExclude>
            <inputExclude>tika-pipes-csv/src/test/resources/test-simple.csv</inputExclude>
          </inputExcludes>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <scm>
    <tag>4.1.0-rc3</tag>
  </scm>
</project>
