Solve the problem of jar conflict in maven of elasticsearch client

Today I try to use the elasticsearch client to access elasticsearch. Its client provides more functionality than writing REST calls yourself, as follows:

The RestClient class is thread-safe, and it is recommended to take it multiple times to improve performance.
Failed to reconnect to the server.
Failover Rescue (HA)
load balancing.

 Reference address:  https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low.html

There is a section in its documentation dedicated to the conflict between its jar and other jars. I think the method it said is not very effective. After thinking about it, the solution is as follows:

Enter elasticsearch's own local maven repository path, such as:

/maven/maven_repository/org/elasticsearch/client/elasticsearch-rest-client/5.6.2

Check out its project's original maven dependency file: elasticsearch-rest-client-5.6.2.pom

Check how the dependencies in this file are configured, paste these dependencies into your own pom.xml, and then remove the dependencies of your conflicting jars (if your previous dependencies cannot be changed, refer to the official website). Dependency conflict resolution bar), and that's it.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326261305&siteId=291194637