Thanks for the point Allan. However, I need to clarify that I'm not trying to resolve the dependencies within my plugin. My plugin does create a dependency report similar to project-info-reports:dependencies, however with the output as XML file, so that it can be rendered into various formats (e.g. XHTML, Plain text, PDF, etc.). I basically looked up the code in the plugin maven-project-info-reports-plugin, but it contains a lot of "TODOs". That's why I'm not sure if there is a better way to do the dependency resolution.
Thanks, Chris Allan Ramirez <[EMAIL PROTECTED]> wrote: Please try this link http://docs.codehaus.org/display/MAVENUSER/FAQs#FAQs-HowdoIgetaplugin%27sdependenciesfromaMojo%3F -allan [EMAIL PROTECTED] wrote: >Hi, > >As part of my effort to write a customized dependency report (in XML), I >looked at the maven-project-reports-info-plugin to understand how the >dependency resolution works. I made a slight modification, as it somehow >didn't produce the results I wanted. I'm doing the following: > >To get a list of dependencies for a Maven project (List object contains a list >of Dependency objects): > > // get list of dependencies > List dependencies = project.getDependencies(); > > >To get the project artifact associated with a dependency: > > // create project artifact for dependency > Artifact depArtifact = > artifactFactory > .createProjectArtifact(dependency.getGroupId(), dependency > .getArtifactId(), dependency.getVersion(), > dependency.getScope()); > > >To get a Maven project object associated with an artifact (assuming that the >Artifact type is "pom"): > > // get project associated with artifact > return mavenProjectBuilder.buildFromRepository(artifact, > project.getRemoteArtifactRepositories(), localRepository); > > >At last I'm resolving transitive dependencies by looking up the Maven project >object associated with a dependency, getting a list of dependencies from that >project object, getting the project artifact associated with each of those >dependencies (to get download URL and description). I can parse the dependency >tree by doing this recursively (though I'm stopping at level 1 at this point). > >Can anybody tell me if there is a better way (and possibly a way which >guarantees that this still will work with Maven 2.1+) to do this work? > >Thanks, >Chris > > > > >------------------------------------------------------------------------ > >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.1.371 / Virus Database: 267.14.14/222 - Release Date: 1/5/2006 > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]