NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor conflits on Elastic Search jar
You should try to find where the "old" version of guava is taken from and to exclude it once for all.
Find the dependency :
mvn dependency:tree | grep guava
Exclude it :
<dependency> <groupId>org.whatever</groupId> <artifactId>the_lib_that_includes_guava</artifactId> <version>0.97</version> <exclusions> <exclusion> <artifactId>com.google</artifactId> <groupId>guava</groupId> </exclusion> </exclusions></dependency>
See https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html for more info on the dependency exclusion.
I add the correct dependency of elasticsearch resolve the problem
<dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>18.0</version></dependency>
Add a dependencyManagement
block solves this problem:
<dependencyManagement> <!-- enforce dependency guava version 20.0 --> <dependencies> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>20.0</version> </dependency> </dependencies></dependencyManagement>
Reference:
http://techidiocy.com/maven-dependency-version-conflict-problem-and-resolution/