}
private void updateMetadata(File dir, Dependency dependency, boolean isSnapshotMetadata) {
// create/update maven-metadata.xml
File metadataFile = new File(dir, "maven-metadata.xml");
Metadata oldMetadata = null;
if (metadataFile.exists()) {
oldMetadata = MetadataReader.readMetadata(metadataFile);
}
Metadata metadata = new Metadata(dependency, isSnapshotMetadata);
if (oldMetadata != null) {
metadata.merge(oldMetadata);
}
FileUtils.writeContent(metadataFile, metadata.toXML());
metadataFile.setLastModified(metadata.lastUpdated.getTime());
// add metadata file to installed artifacts path
reference(metadataFile);
}