use of org.jetbrains.idea.maven.aether.ArtifactRepositoryManager in project intellij-community by JetBrains.
the class DependencyResolvingBuilder method getRepositoryManager.
private static ArtifactRepositoryManager getRepositoryManager(final CompileContext context) {
ArtifactRepositoryManager manager = MANAGER_KEY.get(context);
if (manager == null) {
manager = new ArtifactRepositoryManager(getLocalRepoDir(context), new ProgressConsumer() {
public void consume(String message) {
context.processMessage(new ProgressMessage(message));
}
});
// further init manager here
MANAGER_KEY.set(context, manager);
}
return manager;
}
use of org.jetbrains.idea.maven.aether.ArtifactRepositoryManager in project intellij-community by JetBrains.
the class DependencyResolvingBuilder method checkDependencies.
private static void checkDependencies(CompileContext context, ModuleChunk chunk) throws Exception {
final Collection<JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>>> libs = getRepositoryLibraries(chunk);
if (!libs.isEmpty()) {
final ArtifactRepositoryManager repoManager = getRepositoryManager(context);
for (JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>> lib : libs) {
final RepositoryLibraryDescriptor descriptor = lib.getProperties().getData();
final ResourceGuard guard = ResourceGuard.get(context, descriptor);
if (guard.requestProcessing(context.getCancelStatus())) {
try {
final Collection<File> required = lib.getFiles(JpsOrderRootType.COMPILED);
for (Iterator<File> it = required.iterator(); it.hasNext(); ) {
if (it.next().exists()) {
// leaving only non-existing stuff requiring synchronization
it.remove();
}
}
if (!required.isEmpty()) {
final Collection<File> resolved = repoManager.resolveDependency(descriptor.getGroupId(), descriptor.getArtifactId(), descriptor.getVersion());
if (!resolved.isEmpty()) {
syncPaths(required, resolved);
} else {
LOG.info("No artifacts were resolved for repository dependency " + descriptor.getMavenId());
}
}
} finally {
guard.finish();
}
}
}
}
}
Aggregations