use of org.apache.maven.artifact.repository.ArtifactRepositoryFactory in project intellij-community by JetBrains.
the class MavenEmbedder method createLocalRepository.
private ArtifactRepository createLocalRepository(MavenEmbedderSettings generalSettings) {
ArtifactRepositoryLayout layout = getComponent(ArtifactRepositoryLayout.class, "default");
ArtifactRepositoryFactory factory = getComponent(ArtifactRepositoryFactory.class);
String url = mySettings.getLocalRepository();
if (!url.startsWith("file:"))
url = "file://" + url;
ArtifactRepository localRepository = new DefaultArtifactRepository("local", url, layout);
boolean snapshotPolicySet = mySettings.isOffline();
if (!snapshotPolicySet && generalSettings.getSnapshotUpdatePolicy() == MavenEmbedderSettings.UpdatePolicy.ALWAYS_UPDATE) {
factory.setGlobalUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
}
factory.setGlobalChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
return localRepository;
}
Aggregations