List of usage examples for org.apache.maven.artifact.resolver ArtifactResolver resolveTransitively
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
ArtifactMetadataSource source) throws ArtifactResolutionException, ArtifactNotFoundException;
From source file:org.sonatype.flexmojos.utilities.MavenUtils.java
License:Apache License
/** * Get dependency artifacts for a project using the local and remote repositories to resolve the artifacts * /*w w w .j a va 2 s. com*/ * @param project maven project * @param resolver artifact resolver * @param localRepository artifact repository * @param remoteRepositories List of remote repositories * @param artifactMetadataSource artifactMetadataSource * @param artifactFactory TODO * @return all dependencies from the project * @throws MojoExecutionException thrown if an exception occured during artifact resolving */ @SuppressWarnings("unchecked") public static Set<Artifact> getDependencyArtifacts(MavenProject project, ArtifactResolver resolver, ArtifactRepository localRepository, List remoteRepositories, ArtifactMetadataSource artifactMetadataSource, ArtifactFactory artifactFactory) throws MojoExecutionException { Set<Artifact> artifacts = project.getDependencyArtifacts(); if (artifacts == null) { try { artifacts = project.createArtifacts(artifactFactory, null, null); } catch (InvalidDependencyVersionException e) { throw new MojoExecutionException(e.getMessage(), e); } project.setDependencyArtifacts(artifacts); } ArtifactResolutionResult arr; try { arr = resolver.resolveTransitively(project.getDependencyArtifacts(), project.getArtifact(), remoteRepositories, localRepository, artifactMetadataSource); } catch (AbstractArtifactResolutionException e) { throw new MojoExecutionException(e.getMessage(), e); } Set<Artifact> result = arr.getArtifacts(); // ## 6/18/09 StoneRiver Change to resolve RELEASE Artifact version ## for (Artifact artifact : result) { if (artifact.getVersion().equals(Artifact.RELEASE_VERSION)) { getReleaseVersion(artifact, localRepository, remoteRepositories, artifactMetadataSource); } } return result; }