You can use DependencyFilter on the air of Eclipses. The full version for the sample below can be found in this amazing set of Ether Snippets.
DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE, JavaScopes.PROVIDED); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot( new Dependency( artifact, JavaScopes.COMPILE ) ); collectRequest.setRepositories(repositories); DependencyRequest dependencyRequest = new DependencyRequest( collectRequest, classpathFilter ); List<ArtifactResult> artifactResults = system.resolveDependencies( session, dependencyRequest ).getArtifactResults();
UPDATE
Version 0.9.0M3 is not compatible with Maven 3.1.0, so do not use it inside Maven, i.e. in the plugin.
source share