2

I was compiling an "old" open sourced project, while encountered this problem:

[ERROR] Failed to execute goal on project .... Can not transfer artifact x:y:z from ...

the artifact x:y:z is not found from all repositories defined in the project pom.xml.

After looked up the effective pom.xml, I could not find any references to x:y:z.

How can I find out which artifact or plugin is requesting a missing dependency without analyze all transitive dependencies?

whz-pa
  • 25
  • 4

1 Answers1

1

If you use eclipe - you can see dep tree like this: open pom.xml and tick "Dependency Hierarchy" tab.

Also you can try to use mvn dependency:tree but I am not totally sure that it will work if some of your deps are missing.

UPDATE: seems like both eclipse and dependency:tree require sucessfull artifact resolution to work whch is not your case.

In this case I guess you're left with 3 opttions:

  1. clean your cache (wipe everything under ~/.m2/repository), run your build and do occurence search (search for something like "problematic-artifact-id") on files in your ~/.m2/repository. One or couple of the artifacts should reference the problematic artifact in their pom. This should give you a hint.

  2. clean your cache and run your build with -X switch. This will put maven in verbosity mode and you should find some hints about what might reference dead dependency (point your attention on download order, what artifacts got resolved, check dependencies of resolved artifacts in their poms)

  3. dumb as hell - comment/uncomment deps in your pom and see what causes the mentioned error.

Eugene Loy
  • 12,224
  • 8
  • 53
  • 79
  • `mvn dependency:tree` will always fail if any of the dependencies is missing or unreachable, so does the m2e plugin. – whz-pa May 22 '13 at 01:26
  • 1. it costs me hours to download old artifacts, so i certainly will not clean the cache; 2. `-X` and any other debug flags do not help, the log shows more verbosely, producing only useless tracing entries; 3. I was going to do the same thing like what you suggest, but finally found `x:y:z` from docjar.com, so I used `mvn install:install-file`. – whz-pa May 22 '13 at 07:17
  • Anyway, @leo, thank you for your suggests. I hope if there is somebody works at Apache and on Maven project will notice this post, so he may consider adding the feature "shows who references a missing dependency" to the `maven-dependency-plugin`. – whz-pa May 22 '13 at 07:24
  • @whz-pa cool. BTW, cleaning cache in (1). is not that required. It is rather to cut of dependencies that are not relevant to your current project. – Eugene Loy May 22 '13 at 07:26