本文整理了Java中org.apache.maven.settings.Settings.getProxies()
方法的一些代码示例,展示了Settings.getProxies()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getProxies()
方法的具体详情如下:
包路径:org.apache.maven.settings.Settings
类名称:Settings
方法名:getProxies
[英]Method getProxies.
[中]方法获取代理。
代码示例来源:origin: apache/maven
/**
* Method removeProxy.
*
* @param proxy
*/
public void removeProxy( Proxy proxy )
{
getProxies().remove( proxy );
} //-- void removeProxy( Proxy )
代码示例来源:origin: apache/maven
/**
* Method addProxy.
*
* @param proxy
*/
public void addProxy( Proxy proxy )
{
getProxies().add( proxy );
} //-- void addProxy( Proxy )
代码示例来源:origin: apache/maven
/**
* @return the first active proxy
*/
public synchronized Proxy getActiveProxy()
{
if ( activeProxy == null )
{
java.util.List<Proxy> proxies = getProxies();
if ( proxies != null && !proxies.isEmpty() )
{
for ( Proxy proxy : proxies )
{
if ( proxy.isActive() )
{
activeProxy = proxy;
break;
}
}
}
}
return activeProxy;
}
代码示例来源:origin: jeremylong/DependencyCheck
/**
* Returns the maven proxy.
*
* @return the maven proxy
*/
private Proxy getMavenProxy() {
if (mavenSettings != null) {
final List<Proxy> proxies = mavenSettings.getProxies();
if (proxies != null && !proxies.isEmpty()) {
if (mavenSettingsProxyId != null) {
for (Proxy proxy : proxies) {
if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) {
return proxy;
}
}
} else {
for (Proxy aProxy : proxies) {
if (aProxy.isActive()) {
return aProxy;
}
}
}
}
}
return null;
}
代码示例来源:origin: apache/maven
/**
* Creates a new request to decrypt the specified settings.
*
* @param settings The settings to decrypt, must not be {@code null}.
*/
public DefaultSettingsDecryptionRequest( Settings settings )
{
setServers( settings.getServers() );
setProxies( settings.getProxies() );
}
代码示例来源:origin: eirslett/frontend-maven-plugin
static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) {
if (mavenSession == null ||
mavenSession.getSettings() == null ||
mavenSession.getSettings().getProxies() == null ||
mavenSession.getSettings().getProxies().isEmpty()) {
return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList());
} else {
final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies();
final List<ProxyConfig.Proxy> proxies = new ArrayList<ProxyConfig.Proxy>(mavenProxies.size());
for (Proxy mavenProxy : mavenProxies) {
if (mavenProxy.isActive()) {
mavenProxy = decryptProxy(mavenProxy, decrypter);
proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(),
mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts()));
}
}
LOGGER.info("Found proxies: {}", proxies);
return new ProxyConfig(proxies);
}
}
代码示例来源:origin: apache/maven
shallowMergeById( dominant.getProxies(), recessive.getProxies(), recessiveSourceLevel );
shallowMergeById( dominant.getProfiles(), recessive.getProfiles(), recessiveSourceLevel );
代码示例来源:origin: apache/maven
if ( ( settings.getProxies() != null ) && ( settings.getProxies().size() > 0 ) )
for ( Iterator iter = settings.getProxies().iterator(); iter.hasNext(); )
代码示例来源:origin: org.apache.maven/maven-settings
/**
* Method addProxy.
*
* @param proxy
*/
public void addProxy( Proxy proxy )
{
getProxies().add( proxy );
} //-- void addProxy( Proxy )
代码示例来源:origin: apache/maven
List<Proxy> proxies = settings.getProxies();
代码示例来源:origin: org.apache.maven/maven-settings
/**
* Method removeProxy.
*
* @param proxy
*/
public void removeProxy( Proxy proxy )
{
getProxies().remove( proxy );
} //-- void removeProxy( Proxy )
代码示例来源:origin: org.apache.maven/maven-settings
/**
* @return the first active proxy
*/
public synchronized Proxy getActiveProxy()
{
if ( activeProxy == null )
{
java.util.List<Proxy> proxies = getProxies();
if ( proxies != null && !proxies.isEmpty() )
{
for ( Proxy proxy : proxies )
{
if ( proxy.isActive() )
{
activeProxy = proxy;
break;
}
}
}
}
return activeProxy;
}
代码示例来源:origin: apache/maven
for ( Proxy proxy : settings.getProxies() )
代码示例来源:origin: apache/maven
/**
* @param settings could be null
* @return a new instance of settings or null if settings was null.
*/
public static Settings copySettings( Settings settings )
{
if ( settings == null )
{
return null;
}
Settings clone = new Settings();
clone.setActiveProfiles( settings.getActiveProfiles() );
clone.setInteractiveMode( settings.isInteractiveMode() );
clone.setLocalRepository( settings.getLocalRepository() );
clone.setMirrors( settings.getMirrors() );
clone.setModelEncoding( settings.getModelEncoding() );
clone.setOffline( settings.isOffline() );
clone.setPluginGroups( settings.getPluginGroups() );
clone.setProfiles( settings.getProfiles() );
clone.setProxies( settings.getProxies() );
clone.setServers( settings.getServers() );
clone.setSourceLevel( settings.getSourceLevel() );
clone.setUsePluginRegistry( settings.isUsePluginRegistry() );
return clone;
}
}
代码示例来源:origin: apache/maven
for ( Proxy proxy : settings.getProxies() )
代码示例来源:origin: org.apache.maven/maven-settings
if ( ( settings.getProxies() != null ) && ( settings.getProxies().size() > 0 ) )
for ( Iterator iter = settings.getProxies().iterator(); iter.hasNext(); )
代码示例来源:origin: io.tesla.maven/maven-settings-builder
/**
* Creates a new request to decrypt the specified settings.
*
* @param settings The settings to decrypt, must not be {@code null}.
*/
public DefaultSettingsDecryptionRequest( Settings settings )
{
setServers( settings.getServers() );
setProxies( settings.getProxies() );
}
代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven
/**
* Gets proxy selector
*
* @return the selector
*/
public ProxySelector proxySelector() {
DefaultProxySelector dps = new DefaultProxySelector();
for (Proxy proxy : settings.getProxies()) {
dps.add(MavenConverter.asProxy(proxy), proxy.getNonProxyHosts());
}
return dps;
}
代码示例来源:origin: org.kie.soup/kie-soup-maven-integration
private void configureProxiesOnSession( Settings settings, DefaultRepositorySystemSession session ) {
List<org.apache.maven.settings.Proxy> proxies = settings.getProxies();
if (proxies == null || proxies.isEmpty()) {
return;
}
DefaultProxySelector proxySelector = new DefaultProxySelector();
for (org.apache.maven.settings.Proxy proxy : proxies) {
proxySelector.add( new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort()), proxy.getNonProxyHosts() );
}
session.setProxySelector( proxySelector );
}
代码示例来源:origin: spring-projects/sts4
private void injectSettings(ArrayList<ArtifactRepository> repositories) throws MavenException {
Settings settings = getSettings();
RepositorySystem repositorySystem = lookup(RepositorySystem.class);
repositorySystem.injectMirror(repositories, getMirrors());
repositorySystem.injectProxy(repositories, settings.getProxies());
repositorySystem.injectAuthentication(repositories, settings.getServers());
}
内容来源于网络,如有侵权,请联系作者删除!