本文整理汇总了Java中org.eclipse.aether.util.repository.DefaultProxySelector类的典型用法代码示例。如果您正苦于以下问题:Java DefaultProxySelector类的具体用法?Java DefaultProxySelector怎么用?Java DefaultProxySelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultProxySelector类属于org.eclipse.aether.util.repository包,在下文中一共展示了DefaultProxySelector类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newRepositorySystemSession
import org.eclipse.aether.util.repository.DefaultProxySelector; //导入依赖的package包/类
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, String localRepoPath) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(localRepoPath);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
session.setOffline(this.properties.isOffline());
if (this.properties.getConnectTimeout() != null) {
session.setConfigProperty(ConfigurationProperties.CONNECT_TIMEOUT, this.properties.getConnectTimeout());
}
if (this.properties.getRequestTimeout() != null) {
session.setConfigProperty(ConfigurationProperties.REQUEST_TIMEOUT, this.properties.getRequestTimeout());
}
if (isProxyEnabled()) {
DefaultProxySelector proxySelector = new DefaultProxySelector();
Proxy proxy = new Proxy(this.properties.getProxy().getProtocol(),
this.properties.getProxy().getHost(),
this.properties.getProxy().getPort(),
this.authentication);
proxySelector.add(proxy, this.properties.getProxy().getNonProxyHosts());
session.setProxySelector(proxySelector);
}
return session;
}
示例2: selectProxies
import org.eclipse.aether.util.repository.DefaultProxySelector; //导入依赖的package包/类
public ProxySelector selectProxies() {
DefaultProxySelector proxySelector = new DefaultProxySelector();
String httpProxyHost = System.getProperty("http.proxyHost");
if (httpProxyHost != null) {
logger.debug("Setting same proxy for http and https");
int proxyPort = -1;
try {
proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
} catch (NumberFormatException nfe) {
throw new RuntimeException("Invalid (or null) http.proxyPort specified into system.properties");
}
String nonProxyHosts = System.getProperty("http.nonProxyHosts");
nonProxyHosts = (nonProxyHosts != null ? nonProxyHosts : "");
Proxy httpProxy = new Proxy("http", httpProxyHost, proxyPort, null);
Proxy httpsProxy = new Proxy("https", httpProxyHost, proxyPort, null);
proxySelector.add(httpProxy, nonProxyHosts);
proxySelector.add(httpsProxy, nonProxyHosts);
logger.debug("MvnRepo proxy set to {}:{}" + (nonProxyHosts != null ? " (nonProxyHosts:" + nonProxyHosts + ")" : ""), httpProxyHost, proxyPort);
} else {
logger.debug("No proxy set (http.proxyHost not defined).");
}
return proxySelector;
}
示例3: createProxySelector
import org.eclipse.aether.util.repository.DefaultProxySelector; //导入依赖的package包/类
private ProxySelector createProxySelector(
SettingsDecryptionResult decryptedSettings) {
DefaultProxySelector selector = new DefaultProxySelector();
for (Proxy proxy : decryptedSettings.getProxies()) {
Authentication authentication = new AuthenticationBuilder()
.addUsername(proxy.getUsername()).addPassword(proxy.getPassword())
.build();
selector.add(
new org.eclipse.aether.repository.Proxy(proxy.getProtocol(),
proxy.getHost(), proxy.getPort(), authentication),
proxy.getNonProxyHosts());
}
return selector;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:MavenSettings.java
示例4: setupRepoSession
import org.eclipse.aether.util.repository.DefaultProxySelector; //导入依赖的package包/类
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings)
{
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setOffline(false);
Proxy activeProxy = settings.getActiveProxy();
if (activeProxy != null)
{
DefaultProxySelector dps = new DefaultProxySelector();
dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
session.setProxySelector(dps);
}
final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings);
final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);
session.setMirrorSelector(mirrorSelector);
session.setAuthenticationSelector(authSelector);
LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()));
session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
session.setCache(new DefaultRepositoryCache());
boolean cacheNotFoundArtifacts = true;
boolean cacheTransferErrors = true;
session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors));
session.setWorkspaceReader(new ClasspathWorkspaceReader());
if (Boolean.getBoolean("org.apache.maven.log_transfer"))
{
session.setTransferListener(new JULMavenTransferListener());
}
return session;
}
示例5: setupRepoSession
import org.eclipse.aether.util.repository.DefaultProxySelector; //导入依赖的package包/类
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings)
{
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setOffline(false);
Proxy activeProxy = settings.getActiveProxy();
if (activeProxy != null)
{
DefaultProxySelector dps = new DefaultProxySelector();
dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
session.setProxySelector(dps);
}
final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings);
final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);
session.setMirrorSelector(mirrorSelector);
session.setAuthenticationSelector(authSelector);
LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()));
session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
session.setCache(new DefaultRepositoryCache());
boolean cacheNotFoundArtifacts = true;
boolean cacheTransferErrors = true;
session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors));
session.setWorkspaceReader(new ClasspathWorkspaceReader());
session.setTransferListener(new LogTransferListener(System.out));
return session;
}