0

I am facing an issue wherein my pom file which is inheriting from a parent throws a warning - Declared unused dependency found. The issue is my pom file does not have this dependency defined explicitly and neither does immediate the parent pom. The parent pom inherits from another pom for which I do not have the access. When I check the dependency tree for the dependency throwing the warning, I do not see any calling dependency i.e. it just comes in compile time not sure how. Can anyone please help me with any pointeres how I can resolve this? Please note I have tried defining the scope as test/ provided and also using the ignore dependency tag. These approaches does help get rid of warning but I am looking for a cleaner approach to achieve the same.

Ishita
  • 109
  • 2
  • 10
  • What do you mean by: You do not have access to the parent of the parent? Maven will download the parent of the parent to your local repository when you build. If it is not accessible, Maven will at least show a WARNING. – J Fabian Meier Aug 16 '22 at 17:24
  • where can I access this downloaded file from? Sorry I am new to maven and don't have the right context – Ishita Aug 17 '22 at 05:37
  • Your local repository is usually in `/.m2/repository`. The directory structure mimicks the groupId, then artifactId and version. – J Fabian Meier Aug 17 '22 at 06:41
  • thanks for your reply, but this does not work for me even after deleting the specified folder it gets auto downloaded in my scenario – Ishita Aug 17 '22 at 10:23
  • I have noticied some inconsistent behaviour if the external dependency is not explicity called in the pom file it still gets added (though does not have transitive dependency to any another dependency), this same behaviour does not occur in another project. Can you please help me understand what might be the root cause for this? – Ishita Aug 17 '22 at 10:43
  • I cannot completely follow you. The parent POM you are looking for should be in the local repository (if Maven finds it). There are tons of other things in the local repository, usually because they are downloaded by some Maven plugin. These are usually no reason to worry. – J Fabian Meier Aug 17 '22 at 10:57
  • I have tried removing the dependency gtom local repository however the dependency still pops up in dependency tree and also throws a warning at compile time – Ishita Aug 17 '22 at 12:13
  • Removing something from the local repository will not remove it from the project. The local repository is more or less a kind of cache. – J Fabian Meier Aug 17 '22 at 15:06

0 Answers0