Shabin Muhammed
Shabin Muhammed

Reputation: 1142

Unresolved Dependency error in Eclipse

I keep getting the following error in eclipse for a simple Repository interface.

The type org.springframework.data.repository.query.QueryByExampleExecutor
cannot be resolved.
It is indirectly referenced from required .class files

Its a Play Framework 2.5.1 project with MongoDB. Here're the dependencies in build.sbt.

libraryDependencies ++= Seq( javaCore, javaJpa, "javax.inject" % "javax.inject" % "1", "org.springframework" % "spring-core" % "4.3.3.RELEASE", "org.springframework" % "spring-context" % "4.3.3.RELEASE", "org.springframework" % "spring-beans" % "4.3.4.RELEASE" "org.springframework" % "spring-jdbc" % "4.3.4.RELEASE", "org.springframework.data" % "spring-data-jpa" % "1.10.1.RELEASE", "org.springframework.data" % "spring-data-commons-core" % "1.4.1.RELEASE", "org.springframework" % "spring-expression" % "4.3.3.RELEASE", "org.mongodb" % "mongo-java-driver" % "3.2.2", "org.springframework.data" % "spring-data-mongodb" % "1.9.2.RELEASE", "org.mockito" % "mockito-core" % "1.9.5" % "test" )

This is my UserRepository interface UserRepository interface error

Could someone help me solve this issue

Upvotes: 0

Views: 1038

Answers (1)

s7vr
s7vr

Reputation: 75994

The problem is with the spring data commons dependency referenced by spring-data-jpa 1.10.1 Release version.

https://github.com/spring-projects/spring-data-jpa/blob/1.10.1.Release/pom.xml

The pom.xml has a dependency on 1.12.1.RELEASE and infact QueryByExampleExecutor javadocs suggest this class was added in 1.12 release.

The spring data commons version you've referenced is old 1.4.1.Release. So the fix for now would be to upgrade the spring data version to 1.12.1. The other fix could be to downgrade the spring-data-jpa to a version which uses spring data commons 1.4.1.Release version.

Btw you should look into using dependency management tool like Maven to avoid these kinds of problem in future.

Upvotes: 1

Related Questions