store.beginTransaction();
try {
final ArtifactDirectoryDescriptor artifactDescriptor = getOrCreateArtifactDescriptor(store);
final Scanner scanner = new ScannerImpl(scannerPlugins);
try {
consume(scanner.scan(new ClassesDirectory(directory, artifactDescriptor), CLASSPATH));
} catch (IOException e) {
throw new RuntimeException("Cannot scan directory '" + directory.getAbsolutePath() + "'", e);
}
} finally {
store.commitTransaction();