use of org.jetbrains.idea.maven.server.MavenIndicesProcessor in project intellij-community by JetBrains.
the class MavenIndex method doUpdateIndexData.
private void doUpdateIndexData(IndexData data, MavenProgressIndicator progress) throws IOException, MavenServerIndexerException {
final Map<String, Set<String>> groupToArtifactMap = new THashMap<>();
final Map<String, Set<String>> groupWithArtifactToVersionMap = new THashMap<>();
final StringBuilder builder = new StringBuilder();
progress.pushState();
progress.setIndeterminate(true);
try {
myIndexer.processArtifacts(data.indexId, new MavenIndicesProcessor() {
@Override
public void processArtifacts(Collection<MavenId> artifacts) {
for (MavenId each : artifacts) {
String groupId = each.getGroupId();
String artifactId = each.getArtifactId();
String version = each.getVersion();
builder.setLength(0);
builder.append(groupId).append(":").append(artifactId);
String ga = builder.toString();
getOrCreate(groupToArtifactMap, groupId).add(artifactId);
getOrCreate(groupWithArtifactToVersionMap, ga).add(version);
}
}
});
persist(groupToArtifactMap, data.groupToArtifactMap);
persist(groupWithArtifactToVersionMap, data.groupWithArtifactToVersionMap);
} finally {
progress.popState();
}
}
Aggregations