1

Tech: Maven 3 + IntelliJ + ElasticSearch 5.5.0 + Carrot2 3.15.1

I have a project with Carrot2 and ElasticSearch which rise some conflicts. Carrot2 uses Lucene 5.3.1 and ElasticSearch uses 6.3.1 version. I want to force carrot2 to use 6.3.1 Lucene version to fix it.

I have tried to add a property in my project's main pom file:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <java.version>1.8</java.version>
    <elasticsearch.version>5.4.2</elasticsearch.version>
    <org.apache.lucene.version>6.5.1</org.apache.lucene.version>
</properties>

Unfortunately this way still rises an error caused by Lucene versions conflict. Finally, I found the solution for my local machine by changing internal value of carrot's dependency pom file:

<parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>5</version>
</parent>

<groupId>org.carrot2</groupId>
<artifactId>carrot2</artifactId>
<version>3.15.1</version>

<name>Carrot2</name>
(...)
<properties>
(...)
    <org.apache.lucene.version>6.5.1</org.apache.lucene.version>     
    <org.simpleframework.version>2.7.1</org.simpleframework.version>
    <org.carrot2.attributes>1.3.1</org.carrot2.attributes>
</properties>

It works fine but only on my local machine. Lucene version changed in carrot's pom file seems to not propagated and there is need to change this version on any instance of project manually. Is there any possibility to force the maven to use my project property value in external dependency?

Łukasz
  • 11
  • 1
  • Have you tried to [exclude](https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html) the Lucene dependency from the carrot one? – Val Jul 27 '17 at 08:53
  • Don't know what you're trying to do, but I'd suggest using this plugin: https://github.com/carrot2/elasticsearch-carrot2 and stick to the compatible versions of all projects (ES, C2, the plugin itself). – dawid.weiss Jul 27 '17 at 09:31

1 Answers1

0

@Val Thank you. A little explanation:

I have tried add exclusions in a very beginning of problem, but only for lucene-core. It didn't work on my Windows machine, but seems to work correctly on an another linux-based platform. I have added following exclusions and it seems to work on any machine:

<dependency>
    <groupId>org.carrot2</groupId>
    <artifactId>carrot2-core</artifactId>
    <version>3.15.1</version>
    <exclusions>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-analyzers-common</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-backward-codecs</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-highlighter</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-memory</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-queryparser</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-analyzers-smartcn</artifactId>
        </exclusion>
    </exclusions>
</dependency>

However returning back to only one exlusion lucene-core works fine on my ubuntu + intellij17 + maven 3.3.9, but doesn't work on windows + intellij14 + maven 3.3.3.

Procedure: Maven clean -> Reimport all Maven projects -> Rebuild

Seems that both configurations have different strategy of rebuilding / caching, which leads me to confusion.

Łukasz
  • 11
  • 1