<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform-search-solr</artifactId>
    <version>13.10.7</version>
  </parent>
  <artifactId>xwiki-platform-search-solr-api</artifactId>
  <name>XWiki Platform - Search - Solr - API</name>
  <packaging>jar</packaging>
  <description>Solr engine management: configuration, indexing, listeners, script service, etc. This module does not handle the search queries</description>
  <properties>
    <!-- Name to display by the Extension Manager -->
    <xwiki.extension.name>Solr Search API</xwiki.extension.name>
    <xwiki.jacoco.instructionRatio>0.62</xwiki.jacoco.instructionRatio>
    <!-- TODO: Remove once the tests have been fixed to not output anything to the console! -->
    <xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>

    <!-- The Solr framework is designed to be shared for the whole farm -->
    <xwiki.extension.namespaces>{root}</xwiki.extension.namespaces>
  </properties>
  <dependencies>
    <!-- Solr -->
    <dependency>
      <groupId>org.apache.solr</groupId>
      <artifactId>solr-solrj</artifactId>
    </dependency>
    <!-- Embedded Solr instance. -->
    <dependency>
      <groupId>org.apache.solr</groupId>
      <artifactId>solr-core</artifactId>
    </dependency>
    <!-- Solr core depende on a different verison of Jetty which we exclude and thus we need to
      pull the right version here. -->
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-alpn-java-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.http2</groupId>
      <artifactId>http2-http-client-transport</artifactId>
    </dependency>    
    <!-- Solr core depends on a different version of Restlet (than our Rest module) which we exclude and thus we need to
      pull the right version here. -->
    <dependency>
      <groupId>org.restlet.jse</groupId>
      <artifactId>org.restlet</artifactId>
    </dependency>
    <!-- Apache Commons -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <!-- Extract data from attachments -->
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-tika-parsers</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
    </dependency>
    <!-- XWiki dependencies -->
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-component-api</artifactId>
      <version>${commons.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-environment-api</artifactId>
      <version>${commons.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-model-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-oldcore</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-bridge</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-query-manager</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- Embedded in the JAR to be used as default SOLR configuration -->
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-search-solr-server-core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-search-solr-server-core-minimal</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
      <scope>provided</scope>
    </dependency>

    <!-- Testing dependencies -->
    <!-- Since we're mocking a class (XWiki) we need those -->
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-tool-test-component</artifactId>
      <version>${commons.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-test-oldcore</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>test-jar</id>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <includes>
                <include>**/test/**.class</include>
                <include>META-INF/**</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <!-- Specify the "default" execution id so that the "blocker" one is always executed -->
            <id>default</id>
            <configuration>
              <excludes>
                **/DefaultSolrIndexer.java,
                **/SolrIndexEventListener.java,
                **/AbstractSolrMetadataExtractor.java,
                **/EmbeddedSolr.java
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Attach default configuration package -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-search-core</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.xwiki.platform</groupId>
                  <artifactId>xwiki-platform-search-solr-server-core</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                  <destFileName>xwiki-platform-search-solr-server-core.zip</destFileName>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.outputDirectory}/</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>attach-minimal-core</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.xwiki.platform</groupId>
                  <artifactId>xwiki-platform-search-solr-server-core-minimal</artifactId>
                  <version>${project.version}</version>
                  <type>zip</type>
                  <destFileName>xwiki-platform-search-solr-server-core-minimal.zip</destFileName>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.outputDirectory}/</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
