2

My project depends on javax.ws.rs-api:2.0.1 and hadoop-mapreduce-client-core:3.1.0 which in turn depends on jsr311-api:1.1.1.

My project -> javax.ws.rs-api:2.0.1 -> hadoop-mapreduce-client-core:3.1.0 -> jsr311-api:1.1.1

The problem is that class javax.ws.rs.core.Response is included in both javax.ws.rs-api:2.0.1 and jsr311-api:1.1.1, but they have different method signatures. When compiling the project, Maven tried to find the readEntity(Class<T> entityType) method in jsr311-api instead of javax.ws.rs-api, which caused NoSuchMethodError.

I solved this problem by excluding jsr311-api from dependency hadoop-mapreduce-client-core. But I want to understand why Maven tries to use jsr311-api? Is there a dependency classpath? How can I find it?

PS: I know the mechanism of Maven to resolve dependency conflict between different versions of the same artifact, but this problem is different.

Dagang
  • 24,586
  • 26
  • 88
  • 133
  • This should help: https://stackoverflow.com/questions/31740785/why-order-of-maven-dependencies-matter – moilejter Oct 20 '18 at 05:42
  • That's interesting. So it sounds like the parent class' dependency is included on the classpath first. If you run `dependency:build-classpath`, it should generate the classpath from your dependencies. Try adding a removing the exclusion to see what it generates. – Mike Oct 21 '18 at 13:28

0 Answers0