0

I'm trying to get all dependencies (include transitives) within my plugin using mavenProject.getArtifacts() but get an empty Set. part of the dependencies which I have to get cannot be resolved. I know that Maven 3 offers the @requiresDependencyCollection but that is no use for me since I must use Maven 2. What can I do?

user1116377
  • 629
  • 3
  • 15
  • 31
  • Have a look at: http://stackoverflow.com/questions/1492000/how-to-get-access-to-mavens-dependency-hierarchy-within-a-plugin – S.R.I Dec 26 '11 at 14:05
  • "with hierarchical information about the resolved dependencies". Are you sure I can get the info for unresolved dependencies? – user1116377 Dec 26 '11 at 14:35
  • Well, the second answer on that page talks about how to obtain other dependencies that are unresolved, ie. excluded. You could also look at `Artifact` class information for excluded dependencies along with their reasons they were excluded. – S.R.I Dec 26 '11 at 15:11

1 Answers1

0

https://svn.apache.org/repos/asf/maven/shared/trunk/maven-artifact-resolver will help with this.

For an example of its use, see https://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin.

bmargulies
  • 97,814
  • 39
  • 186
  • 310