use of org.apache.maven.plugins.assembly.repository.model.GroupVersionAlignment in project maven-plugins by apache.
the class DefaultRepositoryAssembler method buildRemoteRepository.
public void buildRemoteRepository(File repositoryDirectory, RepositoryInfo repository, RepositoryBuilderConfigSource configSource) throws RepositoryAssemblyException {
MavenProject project = configSource.getProject();
ProjectBuildingRequest buildingRequest = configSource.getProjectBuildingRequest();
Iterable<ArtifactResult> result = null;
Collection<Dependency> dependencies = project.getDependencies();
if (dependencies == null) {
Logger logger = getLogger();
if (logger.isDebugEnabled()) {
logger.debug("dependency-artifact set for project: " + project.getId() + " is null. Skipping repository processing.");
}
return;
}
Collection<Dependency> managedDependencies = null;
if (project.getDependencyManagement() != null) {
managedDependencies = project.getDependencyManagement().getDependencies();
}
// Older Aether versions use an cache which can't be cleared. So can't delete repoDir and use it again.
// Instead create a temporary repository, delete it at end (should be in a finally-block)
File tempRepo = new File(repositoryDirectory.getParentFile(), repositoryDirectory.getName() + "_tmp");
buildingRequest = repositoryManager.setLocalRepositoryBasedir(buildingRequest, tempRepo);
try {
result = dependencyResolver.resolveDependencies(buildingRequest, dependencies, managedDependencies, null);
} catch (DependencyResolverException e) {
throw new RepositoryAssemblyException("Error resolving artifacts: " + e.getMessage(), e);
}
ArtifactFilter filter = buildRepositoryFilter(repository, project);
buildingRequest = repositoryManager.setLocalRepositoryBasedir(buildingRequest, repositoryDirectory);
Map<String, GroupVersionAlignment> groupVersionAlignments = createGroupVersionAlignments(repository.getGroupVersionAlignments());
assembleRepositoryArtifacts(buildingRequest, result, filter, groupVersionAlignments);
if (repository.isIncludeMetadata()) {
// assembleRepositoryMetadata( result, filter, centralRepository, targetRepository );
}
try {
FileUtils.deleteDirectory(tempRepo);
} catch (IOException e) {
// noop
}
}
Aggregations