<?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>

    <parent>
        <groupId>org.wikimedia.discovery</groupId>
        <artifactId>discovery-parent-pom</artifactId>
        <version>1.30</version>
    </parent>

    <groupId>org.wikimedia.search.highlighter</groupId>
    <artifactId>experimental</artifactId>
    <version>6.8.23</version>
    <packaging>pom</packaging>

    <name>Elasticsearch experimental highlighter plugin</name>

    <url>https://doc.wikimedia.org/search-highlighter/</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>manybubbles</id>
            <name>Nik Everett</name>
            <email>nik9000+highlighter@gmail.com</email>
            <timezone>America/New York</timezone>
        </developer>
    </developers>

    <modules>
        <module>experimental-highlighter-core</module>
        <module>experimental-highlighter-lucene</module>
        <module>experimental-highlighter-elasticsearch-plugin</module>
    </modules>

    <scm>
        <connection>scm:git:https://gerrit.wikimedia.org/r/search/highlighter</connection>
        <developerConnection>scm:git:ssh://gerrit.wikimedia.org:29418/search/highlighter</developerConnection>
        <tag>experimental-6.8.23</tag>
        <url>https://gerrit.wikimedia.org/r/#/admin/projects/search/highlighter</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/wikimedia/search-highlighter/issues</url>
    </issueManagement>

    <properties>
        <elasticsearch.version>6.8.23</elasticsearch.version>
        <log4j.version>2.17.1</log4j.version>
        <!-- For the Elasticsearch plugin to work this should match the version of Lucene that Elasticsearch
      uses. -->
        <lucene.version>7.7.3</lucene.version>
        <randomizedtesting.version>2.7.1</randomizedtesting.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <?SORTPOM IGNORE?>
            <dependency>
                <!-- Must come before lucene-core -->
                <!-- This must come before experimental-highlighter-lucene or it won't work. -->
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-test-framework</artifactId>
                <version>${lucene.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>com.carrotsearch.randomizedtesting</groupId>
                        <artifactId>randomizedtesting-runner</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.carrotsearch.randomizedtesting</groupId>
                        <artifactId>junit4-ant</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <?SORTPOM RESUME?>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-core</artifactId>
                <version>${lucene.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-queries</artifactId>
                <version>${lucene.version}</version>
            </dependency>
            <dependency>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch</artifactId>
                <version>${elasticsearch.version}</version>
            </dependency>
            <dependency>
                <groupId>org.wikimedia.search.highlighter</groupId>
                <artifactId>experimental-highlighter-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.wikimedia.search.highlighter</groupId>
                <artifactId>experimental-highlighter-lucene</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!--  FIXME: switch to gradle and reuse elastic integ testing framework -->
            <!--     <dependency> -->
            <!--       <groupId>org.elasticsearch.plugin</groupId> -->
            <!--       <artifactId>analysis-icu</artifactId> -->
            <!--       <version>${elasticsearch.version}</version> -->
            <!--       <scope>test</scope> -->
            <!--     </dependency> -->
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.carrotsearch.randomizedtesting</groupId>
                <artifactId>randomizedtesting-runner</artifactId>
                <version>${randomizedtesting.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>18.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-core</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>${log4j.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-analyzers-common</artifactId>
                <version>${lucene.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-memory</artifactId>
                <version>${lucene.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.elasticsearch</groupId>
                <artifactId>securemock</artifactId>
                <!-- NOTE: make sure that this version is the same granted by elasticsearch
            test framework. e.g. : https://github.com/elastic/elasticsearch/blob/v2.2.1/core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy -->
                <version>1.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.elasticsearch.test</groupId>
                <artifactId>framework</artifactId>
                <version>${elasticsearch.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>1.3</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.carrotsearch.randomizedtesting</groupId>
                    <artifactId>junit4-maven-plugin</artifactId>
                    <version>${randomizedtesting.version}</version>
                    <executions>
                        <execution>
                            <id>tests</id>
                            <goals>
                                <goal>junit4</goal>
                            </goals>
                            <phase>test</phase>
                            <configuration>
                                <excludes>
                                    <exclude>**/ElasticsearchQueryFlattenerTest.class</exclude>
                                </excludes>
                                <skipTests>${skip.unit.tests}</skipTests>
                                <listeners>
                                    <report-text showNumFailures="30" showOutput="onerror" showStackTraces="true" showStatusError="true" showStatusFailure="true" showStatusIgnored="true" showStatusOk="false" showSuiteSummary="true" showThrowable="true" timestamps="false"></report-text>
                                    <report-ant-xml dir="${project.build.directory}/surefire-reports" mavenExtensions="true"></report-ant-xml>
                                </listeners>
                                <heartbeat>20</heartbeat>
                                <jvmOutputAction>warn</jvmOutputAction>
                                <leaveTemporary>true</leaveTemporary>
                                <sysouts>false</sysouts>
                                <assertions>
                                    <enable></enable>
                                </assertions>
                                <jvmArgs>
                                    <param>-Xmx512m</param>
                                    <param>-XX:MaxDirectMemorySize=512m</param>
                                    <param>-Des.logger.prefix=</param>
                                    <param>-Dtests.gradle=yes</param>
                                </jvmArgs>
                            </configuration>
                        </execution>
                        <!-- 
            	FIXME: Separate execution for ElasticsearchQueryFlattenerTest
            	This one does not use Elasticsearch integration testing framework
            	but it needs to run in a separate JVM otherwize the security manager
            	may be loaded and will prevent this test from running correctly.
            	Should be fixed with clear separation of unit tests and integ test
            	when migrating to gradle.
             -->
                        <execution>
                            <id>tests-junit</id>
                            <goals>
                                <goal>junit4</goal>
                            </goals>
                            <phase>test</phase>
                            <configuration>
                                <includes>
                                    <include>**/ElasticsearchQueryFlattenerTest.class</include>
                                </includes>
                                <skipTests>${skip.unit.tests}</skipTests>
                                <listeners>
                                    <report-text showNumFailures="30" showOutput="onerror" showStackTraces="true" showStatusError="true" showStatusFailure="true" showStatusIgnored="true" showStatusOk="false" showSuiteSummary="true" showThrowable="true" timestamps="false"></report-text>
                                    <report-ant-xml dir="${project.build.directory}/surefire-reports" mavenExtensions="true"></report-ant-xml>
                                </listeners>
                                <heartbeat>20</heartbeat>
                                <jvmOutputAction>warn</jvmOutputAction>
                                <leaveTemporary>true</leaveTemporary>
                                <sysouts>false</sysouts>
                                <assertions>
                                    <enable></enable>
                                </assertions>
                                <jvmArgs>
                                    <param>-Xmx512m</param>
                                    <param>-XX:MaxDirectMemorySize=512m</param>
                                    <param>-Des.logger.prefix=</param>
                                    <param>-Dtests.gradle=yes</param>
                                </jvmArgs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>de.is24.mavenplugins</groupId>
                    <artifactId>deadcode4j-maven-plugin</artifactId>
                    <configuration>
                        <superClassesMarkingLiveCode>
                            <liveCode>org.elasticsearch.plugins.Plugin</liveCode>
                        </superClassesMarkingLiveCode>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-enforcer-plugin</artifactId>
                                        <versionRange>[1.0.0,)</versionRange>
                                        <goals>
                                            <goal>enforce</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>de.thetaphi</groupId>
                                        <artifactId>forbiddenapis</artifactId>
                                        <versionRange>[1.5,)</versionRange>
                                        <goals>
                                            <goal>testCheck</goal>
                                            <goal>check</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
