BRIAN FOX-5 wrote: > > Take a look at the maven-dependency-plugin copy-dependencies code, > this is pretty much exactly what you're trying to do. There are > filters that are in a common jar you can reuse to filter out > transitivity etc. > Thanks for the replies guys. I need to download the transitive dependencies of the project's depencies, each into their own folder, like this: A's dependencies - I - II - III I's dependencies - 1 - 2 II's dependencies - 3 - 4 Copy from the repo the dependencies in the following folder structure: I - 1 - 2 II - 3 - 4
For further reference - use ArtifactResolver.resolveTransitively(). Besides resolving transitively, it returns an ArtifactResolutionResult which has a getArtifacts() method which has all the artifacts you need. So, steps: - get the projects artifacts - resolve each one transitively - use the ArtifactResolutionResult to get the transitive dependencies for each dependency (so we don't mix them up) - use the resulting artifacts' .getFile() method to get & later to copy the file where you need it Something like this: Artifact dependency = (Artifact)(mainProject().getArtifacts().iterator().next()); MavenProject dependencyProject = projectBuilder.buildFromRepository(dependency, remoteArtifactRepositories, localRepository); Set artifacts = dependencyProject.createArtifacts(artifactFactory, null, null); ArtifactResolutionResult artifactResolved = artifactResolver.resolveTransitively(artifacts, dependency, remoteArtifactRepositories, localRepository, artifactMetadataSource); artifactResolved.getArtifacts(); ... iterate over the resulting artifacts & do your stuff :) -- View this message in context: http://www.nabble.com/Copy-transitive-dependencies-tp24376786p24406881.html Sent from the Maven Developers mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
