<?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 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>jena-text-es</artifactId>
  <packaging>jar</packaging>
  <name>Apache Jena - SPARQL Text Search - Elasticsearch</name>

  <parent>
    <groupId>org.apache.jena</groupId>
    <artifactId>jena</artifactId>
    <version>3.10.0</version>
    <relativePath>..</relativePath>
  </parent>

  <properties>
    <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
    <build.time.xsd>${maven.build.timestamp}</build.time.xsd>
    <es.startup.timeout>90</es.startup.timeout>
    <automatic.module.name>org.apache.jena.text.es</automatic.module.name>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-text</artifactId>
      <version>3.10.0</version>
    </dependency>
    
    <!-- Testing support -->
    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-base</artifactId>
      <version>3.10.0</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>

    
    <!-- Elasticsearch client -->
    <dependency>
      <groupId>org.elasticsearch.client</groupId>
      <artifactId>transport</artifactId>
      <exclusions>
        <!-- Take "jackson" that comes via jsonld-java
             At Jena 3.7.0 that is jsonld-java v0.11.1 depends on jackson 2.9.0
             whereas elasticsearch depends on jackson 2.8.6
        -->
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </dependency>
    
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-to-slf4j</artifactId>
    </dependency>
    
    <!-- Convert commons logging to SLF4J -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    
  </dependencies>
  
  <build>
    
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!-- Skip the default running of this plug-in (or everything is run twice...see below) -->
          <skip>true</skip>
        </configuration>
        <executions>
          <execution>
            <id>unit-tests</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>false</skip>
              <includes>
                <include>**/TS_*.java</include>
              </includes>
              <excludes>
                <exclude>**/*IT.java</exclude>
              </excludes>
            </configuration>
          </execution>
          <execution>
            <id>integration-tests</id>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>false</skip>
              <includes>
                <include>**/*IT.java</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.alexcojocaru</groupId>
        <artifactId>elasticsearch-maven-plugin</artifactId>
        <!-- REPLACE THE FOLLOWING WITH THE PLUGIN VERSION YOU NEED -->
        <version>${ver.elasticsearch.maven.plugin}</version>
        <configuration>
          <clusterName>elasticsearch</clusterName>
          <transportPort>9500</transportPort>
          <httpPort>9400</httpPort>
          <timeout>${es.startup.timeout}</timeout>
          <version>${ver.elasticsearch}</version>
        </configuration>
        <executions>
          <!--
              The elasticsearch maven plugin goals are by default bound to the
              pre-integration-test and post-integration-test phases
          -->
          <execution>
            <id>start-elasticsearch</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>runforked</goal>
            </goals>
          </execution>
          <execution>
            <id>stop-elasticsearch</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
                    </goals>
          </execution>
            </executions>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
          <!-- Only material in the main jar <execution> <id>attach-sources-test</id> 
               <goals> <goal>test-jar-no-fork</goal> </goals> </execution> 
               -->
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <version>true</version>
          <show>public</show>
          <quiet>true</quiet>
          <encoding>UTF-8</encoding>
          <windowtitle>${project.name} ${project.version}</windowtitle>
          <doctitle>${project.name} ${project.version}</doctitle>
          <bottom>Licenced under the Apache License, Version 2.0</bottom>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <overWriteReleases>false</overWriteReleases>
          <overWriteIfNewer>true</overWriteIfNewer>
        </configuration>
      </plugin>

    </plugins>
    
  </build>
  
</project>
