Reputation: 1695
I am using methods getDependencyManagement() and getDependencies() of class org.apache.maven.project.MavenProject to get a list of dependencies of pom.xml on which the plugin is executed, but I am also getting the inherited dependencies.
How I can get a list of dependencies defined directly inside the pom.xml, and not any of the inherited ones.
Upvotes: 1
Views: 549
Reputation: 13978
From the MavenProject
class you can use the getDependencyArtifacts()
method. Its Javadoc reads:
/**
* Direct dependencies that this project has.
* @return Set<Artifact>
* @see #getArtifacts() to get all transitive dependencies
*/
Upvotes: 1