What I'm doing exactly is as following: 1) I create an Artifact object using groupId, artifactId and version provided in the plugin configuration (the type is always "pom") 2) Using this artifact, I create a MavenProject object (with the buildFromRepository(...) method of a MavenProjectBuilder instance) 3) At this step, I want that a call to getArtifacts or getDependenciesArtifact returns the list of dependencies (non transitive or transitive) => in fact, it does not: getArtifacts returns an empty set while getDependenciesArtifact returns null.
I've discovered the createArtifacts method of MavenProject thanks to your code, and it seems to create the set of (non transitive) dependencies artifact I was looking for. But what about transitive dependencies ? Do I have to take each artifact in the set returned by createArtifacts and "resolve" it recursively to get the "transitive" set of dependencies ? If yes, which method do I use knowing that I have an Artifact object and I want its set of artifact dependencies ? Thanks for your help, Sebastien -----Original Message----- From: Mark Hobson [mailto:[EMAIL PROTECTED] Sent: Friday, November 10, 2006 4:53 PM To: Maven Users List Subject: Re: Resolving project dependencies On 10/11/06, Sebastien Brunot <[EMAIL PROTECTED]> wrote: > I'm not sure I undestand your question, but I want to get a list of > all the artifact that correspond to a dependency declared in the > MavenProject POM, with or without transitivity depending on a > parameter set in my plugin configuration. Without transitivity is > mandatory, with transitivity is optional. I believe that: project.getArtifacts() returns all the project's dependencies, including transitive ones; and project.getDependencyArtifacts() only returns the immediate dependencies declared in the project's pom. Although you say you're trying to resolve the dependencies of a dependency in a project? As soon as you start traversing deeper than the first level of dependencies in the pom, you need to start resolving them yourself. I've recently extracted code to do this into a shared component that's currently sitting in JIRA, see: http://jira.codehaus.org/browse/MNG-2654 Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
