use of org.apache.maven.artifact.InvalidRepositoryException 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.InvalidRepositoryException 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.InvalidRepositoryException in project kie-wb-common by kiegroup.
the class AFSettingsXmlConfigurationProcessor method populateFromSettings.
private MavenExecutionRequest populateFromSettings(MavenExecutionRequest request, Settings settings) throws MavenExecutionRequestPopulationException {
if (settings == null) {
return request;
}
request.setOffline(settings.isOffline());
request.setInteractiveMode(settings.isInteractiveMode());
request.setPluginGroups(settings.getPluginGroups());
request.setLocalRepositoryPath(settings.getLocalRepository());
for (Server server : settings.getServers()) {
server = server.clone();
request.addServer(server);
}
for (Proxy proxy : settings.getProxies()) {
if (!proxy.isActive()) {
continue;
}
proxy = proxy.clone();
request.addProxy(proxy);
}
for (Mirror mirror : settings.getMirrors()) {
mirror = mirror.clone();
request.addMirror(mirror);
}
request.setActiveProfiles(settings.getActiveProfiles());
for (org.apache.maven.settings.Profile rawProfile : settings.getProfiles()) {
request.addProfile(SettingsUtils.convertFromSettingsProfile(rawProfile));
if (settings.getActiveProfiles().contains(rawProfile.getId())) {
List<Repository> remoteRepositories = rawProfile.getRepositories();
for (Repository remoteRepository : remoteRepositories) {
try {
request.addRemoteRepository(MavenRepositorySystem.buildArtifactRepository(remoteRepository));
} catch (InvalidRepositoryException e) {
// do nothing for now
}
}
List<Repository> pluginRepositories = rawProfile.getPluginRepositories();
for (Repository pluginRepository : pluginRepositories) {
try {
request.addPluginArtifactRepository(MavenRepositorySystem.buildArtifactRepository(pluginRepository));
} catch (InvalidRepositoryException e) {
// do nothing for now
}
}
}
}
return request;
}
use of org.apache.maven.artifact.InvalidRepositoryException in project sts4 by spring-projects.
the class MavenBridge method addArtifactRepositories.
private void addArtifactRepositories(ArrayList<ArtifactRepository> artifactRepositories, List<Repository> repositories) throws MavenException {
for (Repository repository : repositories) {
try {
ArtifactRepository artifactRepository = lookup(RepositorySystem.class).buildArtifactRepository(repository);
artifactRepositories.add(artifactRepository);
} catch (InvalidRepositoryException ex) {
throw new MavenException(ex);
}
}
}
Aggregations