Maven: How to get all transitive dependencies programmatically in MOJO

Possible duplicate:
How to access the dependency hierarchy Maven & rsquo; within the plugin.

Dependency: plugin tree: target has the option "verbose", which displays all conflicts and duplicates in the dependency tree. However, I am trying to reuse this information in my own mojo for reporting, but I can’t understand how exactly this plugin collects all transitive dependencies \ artifacts.

I tried:

ArtifactResolutionResult result = _artifactCollector.collect( _project.getDependencyArtifacts(), _project.getArtifact(), _project.getManagedVersionMap(),
            _localRepository, _project.getRemoteArtifactRepositories(), _artifactMetadataSource, null, Collections.EMPTY_LIST );

As far as I can tell, this is how the tree’s purpose does this, with the exception of the listener.

Does anyone know how to do what I ask?

UPDATE: I have not searched well enough, my question is duplicate:. Please vote for closing, as I already did, thanks.

+3

Source: https://habr.com/ru/post/1725426/


All Articles