Used undeclared dependencies can be found with mvn dependency:analyze

  1. mvn dependency:analyze
  2. mvn dependency:tree -Dincludes=groupId:artifactId:type:version

How can I see where the code using an undeclared dependency is?

Exclude the dependency and see what fails.

What's the issue?

Potentially, your source code is using a library that your Project Object Model (pom) does not declare as a dependency.

How can I fix the issue?

Declare your dependency explicitly.

How can I avoid this issue?

Only use classes that resolve as a first-level dependency. The easiest way to do this is to be aware of the classes that should be available to your source code. Avoid making your class choices by seeing what's available on your IDE's autocomplete menu.

There is also "Transitive Dependency Management", but that's a bit heavy handed. See more details in Gradle's nice overview.