Home > Mobile >  Resolving Maven Dependency in Eclipse
Resolving Maven Dependency in Eclipse

Time:07-01

I'm trying to resolve a maven dependency in my eclipse project.

The dependency has already been downloaded into my maven dependencies folder (as can be seen below)

Dependency Folder

Relevant Dependency

However, the import statement still isn't resolving.

In my java build path, the Maven Dependencies folder is present.

Maven Dependencies

So far, I've tried rebuilding the project on the command line and refreshing it in eclipse; I've tried rebuilding it in in eclipse itself; and I've tried updating the project in eclipse.

Nothing seems to work. Any help would be appreciated.

EDIT: Here's my POM file for those of you who asked.

POM 1 POM 2 POM 3

CodePudding user response:

I don't use eclipse but the general idea is to delete all dependencies in your dependency folder and rebuild or you can also change the version of the dependency that is throwing the error. Sometimes, the name of the class you are calling may be changed in the version you are using.

CodePudding user response:

Your dependency is set as under the test scope. This means that it's only available in test classes (e.g. src/test/java). If you want to use it in your main app src/main/java remove the test scope.

CodePudding user response:

With a right-mouse click on the project node in the Package Explorer and selecting menu Maven -> Update Project..., you can update the Maven dependencies.

You also have to keep in mind, that Maven has often dependencies in a "test" scope in the pom.xml. In that case you can use these dependencies only under the src/test/java path.

  • Related