use of org.apache.maven.artifact.repository.ArtifactRepository in project intellij-community by JetBrains.
the class Maven3ServerEmbedderImpl method convertRepositories.
@NotNull
protected List<ArtifactRepository> convertRepositories(List<MavenRemoteRepository> repositories) throws RemoteException {
List<ArtifactRepository> result = new ArrayList<ArtifactRepository>();
for (MavenRemoteRepository each : repositories) {
try {
ArtifactRepositoryFactory factory = getComponent(ArtifactRepositoryFactory.class);
result.add(ProjectUtils.buildArtifactRepository(MavenModelConverter.toNativeRepository(each), factory, myContainer));
} catch (InvalidRepositoryException e) {
Maven3ServerGlobals.getLogger().warn(e);
}
}
return result;
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project intellij-community by JetBrains.
the class Maven2ServerEmbedderImpl method convertRepositories.
private List<ArtifactRepository> convertRepositories(List<MavenRemoteRepository> repositories) throws RemoteException {
List<ArtifactRepository> result = new ArrayList<ArtifactRepository>();
for (MavenRemoteRepository each : repositories) {
try {
ArtifactRepositoryFactory factory = getComponent(ArtifactRepositoryFactory.class);
result.add(ProjectUtils.buildArtifactRepository(Maven2ModelConverter.toNativeRepository(each), factory, getContainer()));
} catch (InvalidRepositoryException e) {
Maven2ServerGlobals.getLogger().warn(e);
}
}
return result;
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project intellij-community by JetBrains.
the class Maven30ServerEmbedderImpl method createLocalRepository.
private ArtifactRepository createLocalRepository() {
try {
final ArtifactRepository localRepository = getComponent(RepositorySystem.class).createLocalRepository(new File(myMavenSettings.getLocalRepository()));
final String customRepoId = System.getProperty("maven3.localRepository.id", "localIntelliJ");
if (customRepoId != null) {
// see details at https://youtrack.jetbrains.com/issue/IDEA-121292
localRepository.setId(customRepoId);
}
return localRepository;
} catch (InvalidRepositoryException e) {
throw new RuntimeException(e);
// Legacy code.
}
//ArtifactRepositoryLayout layout = getComponent(ArtifactRepositoryLayout.class, "default");
//ArtifactRepositoryFactory factory = getComponent(ArtifactRepositoryFactory.class);
//
//String url = myMavenSettings.getLocalRepository();
//if (!url.startsWith("file:")) url = "file://" + url;
//
//ArtifactRepository localRepository = factory.createArtifactRepository("local", url, layout, null, null);
//
//boolean snapshotPolicySet = myMavenSettings.isOffline();
//if (!snapshotPolicySet && snapshotUpdatePolicy == MavenServerSettings.UpdatePolicy.ALWAYS_UPDATE) {
// factory.setGlobalUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
//}
//factory.setGlobalChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
//
//return localRepository;
}
use of org.apache.maven.artifact.repository.ArtifactRepository 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;
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project asterixdb by apache.
the class SourcePointerResolver method collectSourcePointers.
private void collectSourcePointers() throws ProjectBuildingException, IOException {
try (StubArtifactRepository stubRepo = new StubArtifactRepository()) {
DefaultRepositoryRequest rr = new DefaultRepositoryRequest();
rr.setLocalRepository(stubRepo);
ArtifactRepository central = getCentralRepository();
rr.setRemoteRepositories(Collections.singletonList(central));
ArtifactResolutionRequest request = new ArtifactResolutionRequest(rr);
for (LicensedProjects lp : mojo.getLicenseMap().values()) {
if (lp.getLicense().getDisplayName() != null && lp.getLicense().getDisplayName().toLowerCase().contains("cddl")) {
ensureCDDLSourcesPointer(lp.getProjects(), central, request);
}
}
}
}
Aggregations