/** * @return http client that submits the coveralls data */ protected CoverallsClient createCoverallsClient() { return new CoverallsProxyClient(coverallsUrl, settings.getActiveProxy()); }
/** * @return http client that submits the coveralls data */ protected CoverallsClient createCoverallsClient() { return new CoverallsProxyClient(coverallsUrl, settings.getActiveProxy()); }
public void setProxySystemProperties() { Proxy activeProxy = session.getSettings().getActiveProxy(); if (activeProxy != null && activeProxy.getProtocol() != null && activeProxy.getProtocol().contains("http")) { log.debug("Setting proxy properties"); System.setProperty("http.proxyHost", activeProxy.getHost()); System.setProperty("http.proxyPort", String.valueOf(activeProxy.getPort())); System.setProperty("http.proxyUser", StringUtils.defaultString(activeProxy.getUsername(), "")); System.setProperty("http.proxyPassword", StringUtils.defaultString(activeProxy.getPassword(), "")); System.setProperty("http.nonProxyHosts", StringUtils.defaultString(activeProxy.getNonProxyHosts(), "")); } } }
@Nullable private ProxySettings extractProxySettings() { final ProxySettings result; if (this.isUseMavenProxy()) { final Proxy activeMavenProxy = this.settings == null ? null : this.settings.getActiveProxy(); result = activeMavenProxy == null ? null : new ProxySettings(activeMavenProxy); getLog().debug("Detected maven proxy : " + result); } else { result = this.proxy; if (result != null) { getLog().debug("Defined proxy : " + result); } } return result; }
public void execute() throws MojoExecutionException { Log log = getLog(); NPMModule.proxy = settings.getActiveProxy(); for (String aPackage : packages) { NPMModule.fromQueryString(log,aPackage).saveToFileWithDependencies(outputDirectory); } } }
private void addProxyOption(final List<String> args) { if (isNotEmpty(proxy)) { addStringOption(args, "--proxy=", proxy); } else if (hasServerSettings()) { final Proxy activCfgProxy = settings.getActiveProxy(); if (activCfgProxy != null) { addStringOption(args, "--proxy=", activCfgProxy.getHost() + ":" + activCfgProxy.getPort()); } } }
protected ClientConfiguration getClientConfiguration() { ClientConfiguration clientConfiguration = new ClientConfiguration().withUserAgent(getUserAgent()); if (null != this.settings && null != settings.getActiveProxy()) { Proxy proxy = settings.getActiveProxy(); clientConfiguration.setProxyHost(proxy.getHost()); clientConfiguration.setProxyUsername(proxy.getUsername()); clientConfiguration.setProxyPassword(proxy.getPassword()); clientConfiguration.setProxyPort(proxy.getPort()); } return clientConfiguration; }
protected String getActiveProxyAsHttpproxy() { if (getSettings() == null) { return null; } final Settings settings = getSettings(); final Proxy activeProxy = settings.getActiveProxy(); if (activeProxy == null || activeProxy.getHost() == null) { return null; } return createXJCProxyArgument(activeProxy.getHost(), activeProxy.getPort(), activeProxy.getUsername(), activeProxy.getPassword()); }
protected String getActiveProxyAsHttpproxy() { if (getSettings() == null) { return null; } final Settings settings = getSettings(); final Proxy activeProxy = settings.getActiveProxy(); if (activeProxy == null || activeProxy.getHost() == null) { return null; } return createXJCProxyArgument(activeProxy.getHost(), activeProxy.getPort(), activeProxy.getUsername(), activeProxy.getPassword()); }
/** * Convenience method to map a Proxy object from the user system settings to a ProxyInfo object. * @param settings project settings given by maven * @return a proxyInfo object instancied or null if no active proxy is define in the settings.xml */ public static ProxyInfo getProxyInfo( Settings settings ) { ProxyInfo proxyInfo = null; if ( settings != null && settings.getActiveProxy() != null ) { Proxy settingsProxy = settings.getActiveProxy(); proxyInfo = new ProxyInfo(); proxyInfo.setHost( settingsProxy.getHost() ); proxyInfo.setType( settingsProxy.getProtocol() ); proxyInfo.setPort( settingsProxy.getPort() ); proxyInfo.setNonProxyHosts( settingsProxy.getNonProxyHosts() ); proxyInfo.setUserName( settingsProxy.getUsername() ); proxyInfo.setPassword( settingsProxy.getPassword() ); } return proxyInfo; }
/** * Try to load the active maven proxy. */ protected void loadMavenProxy() { if (settings == null) return; try { Proxy mvnProxy = settings.getActiveProxy(); if (mvnProxy != null) { ProxyConfiguration newProxyConf = new ProxyConfiguration(); newProxyConf.setHost(mvnProxy.getHost()); newProxyConf.setPort(mvnProxy.getPort()); newProxyConf.setUsername(mvnProxy.getUsername()); newProxyConf.setPassword(mvnProxy.getPassword()); newProxyConf.setHostExclusions(mvnProxy.getNonProxyHosts()); proxyConfig = newProxyConf; getLog().info("Maven proxy loaded successfully"); } else { getLog().warn("No maven proxy found, but useMavenProxy set to true."); } } catch (Exception e) { getLog().error("Error while loading maven proxy", e); } }
/** * Convenience method to map a <code>Proxy</code> object from the user system settings to a <code>ProxyInfo</code> * object. * * @return a proxyInfo object or null if no active proxy is define in the settings.xml */ private static ProxyInfo getProxyInfo( Settings settings ) { ProxyInfo proxyInfo = null; if ( settings != null && settings.getActiveProxy() != null ) { Proxy settingsProxy = settings.getActiveProxy(); proxyInfo = new ProxyInfo(); proxyInfo.setHost( settingsProxy.getHost() ); proxyInfo.setType( settingsProxy.getProtocol() ); proxyInfo.setPort( settingsProxy.getPort() ); proxyInfo.setNonProxyHosts( settingsProxy.getNonProxyHosts() ); proxyInfo.setUserName( settingsProxy.getUsername() ); proxyInfo.setPassword( settingsProxy.getPassword() ); } return proxyInfo; }
/** * Convenience method to convert the {@link org.apache.maven.settings.Proxy} object from a * {@link org.apache.maven.settings.Settings} into a {@link org.apache.maven.wagon.proxy.ProxyInfo}. * * @param settings The settings to use. * @return The proxy details from the settings or <code>null</code> if the settings do not define a proxy. */ public static ProxyInfo getProxyInfo( Settings settings ) { ProxyInfo proxyInfo = null; if ( settings != null && settings.getActiveProxy() != null ) { proxyInfo = new ProxyInfo(); final Proxy proxy = settings.getActiveProxy(); proxyInfo.setHost( proxy.getHost() ); proxyInfo.setType( proxy.getProtocol() ); proxyInfo.setPort( proxy.getPort() ); proxyInfo.setNonProxyHosts( proxy.getNonProxyHosts() ); proxyInfo.setUserName( proxy.getUsername() ); proxyInfo.setPassword( proxy.getPassword() ); } return proxyInfo; }
MavenMvnSettings(MavenConfig config, RepositorySystem repoSystem, RepositoryListener listener) throws ArtifactException { Settings settings = buildMavenSettings(config.getSettings()); repositories = Collections.unmodifiableList(buildRemoteRepositories(settings)); Proxy proxy = settings.getActiveProxy(); MavenProxySelector proxySelector = null; if (proxy != null) { MavenProxySelector.Builder builder = new MavenProxySelector.Builder(proxy.getHost(), proxy.getPort(), proxy.getProtocol()); builder.setPassword(proxy.getPassword()); builder.setUserName(proxy.getUsername()); if (proxy.getNonProxyHosts() != null) { String[] hosts = proxy.getNonProxyHosts().split("\\|"); builder.addNonProxyHosts(Arrays.asList(hosts)); } proxySelector = builder.build(); } session = Util.newRepositorySession(repoSystem, settings.getLocalRepository() == null ? config.getLocalRepository() : Paths.get(settings.getLocalRepository()), listener, proxySelector, settings.isOffline()); }
/** * Convenience method to convert the {@link org.apache.maven.settings.Proxy} object from a * {@link org.apache.maven.settings.Settings} into a {@link org.apache.maven.wagon.proxy.ProxyInfo}. * * @param settings The settings to use. * @return The proxy details from the settings or <code>null</code> if the settings do not define a proxy. */ public static ProxyInfo getProxyInfo( Settings settings ) { ProxyInfo proxyInfo = null; if ( settings != null && settings.getActiveProxy() != null ) { proxyInfo = new ProxyInfo(); final Proxy proxy = settings.getActiveProxy(); proxyInfo.setHost( proxy.getHost() ); proxyInfo.setType( proxy.getProtocol() ); proxyInfo.setPort( proxy.getPort() ); proxyInfo.setNonProxyHosts( proxy.getNonProxyHosts() ); proxyInfo.setUserName( proxy.getUsername() ); proxyInfo.setPassword( proxy.getPassword() ); } return proxyInfo; }
static RemoteRepository convertToMavenRepo(final DependencyRepository repo, final Settings settings) { RemoteRepository remoteRepository = new RemoteRepository(repo.getId(), "default", repo.getUrl()); Proxy activeProxy = settings.getActiveProxy(); if (activeProxy != null) { Authentication auth = new Authentication(activeProxy.getUsername(), activeProxy.getPassword()); remoteRepository.setProxy(new org.sonatype.aether.repository.Proxy(activeProxy.getProtocol(), activeProxy .getHost(), activeProxy.getPort(), auth)); } return remoteRepository; }
static RemoteRepository convertToMavenRepo(final String id, String url, final Settings settings) { RemoteRepository.Builder remoteRepositoryBuilder = new RemoteRepository.Builder(id, "default", url); Proxy activeProxy = settings.getActiveProxy(); if (activeProxy != null) { Authentication auth = new AuthenticationBuilder().addUsername(activeProxy.getUsername()) .addPassword(activeProxy.getPassword()).build(); remoteRepositoryBuilder.setProxy(new org.eclipse.aether.repository.Proxy(activeProxy.getProtocol(), activeProxy .getHost(), activeProxy.getPort(), auth)); } return remoteRepositoryBuilder.build(); }
public static RemoteRepository convertToMavenRepo(final DependencyRepository repo, final Settings settings) { RemoteRepository.Builder remoteRepositoryBuilder = new RemoteRepository.Builder(repo.getId(), "default", repo.getUrl()); Proxy activeProxy = settings.getActiveProxy(); if (activeProxy != null) { Authentication auth = new AuthenticationBuilder().addUsername(activeProxy.getUsername()) .addPassword(activeProxy.getPassword()).build(); remoteRepositoryBuilder.setProxy(new org.eclipse.aether.repository.Proxy(activeProxy.getProtocol(), activeProxy .getHost(), activeProxy.getPort(), auth)); } return remoteRepositoryBuilder.build(); }
private org.apache.maven.repository.Proxy configureProxyToInlineRepo() { if (mavenSession != null && mavenSession.getSettings() != null) { Proxy proxy = mavenSession.getSettings().getActiveProxy(); org.apache.maven.repository.Proxy mavenProxy = new org.apache.maven.repository.Proxy(); if (proxy != null) { mavenProxy.setProtocol(proxy.getProtocol()); mavenProxy.setHost(proxy.getHost()); mavenProxy.setPort(proxy.getPort()); mavenProxy.setNonProxyHosts(proxy.getNonProxyHosts()); mavenProxy.setUserName(proxy.getUsername()); mavenProxy.setPassword(proxy.getPassword()); return mavenProxy; } else { return null; } } else { return null; } }
private org.apache.maven.repository.Proxy configureProxyToInlineRepo() { if (mavenSession != null && mavenSession.getSettings() != null) { Proxy proxy = mavenSession.getSettings().getActiveProxy(); org.apache.maven.repository.Proxy mavenProxy = new org.apache.maven.repository.Proxy(); if (proxy != null) { mavenProxy.setProtocol(proxy.getProtocol()); mavenProxy.setHost(proxy.getHost()); mavenProxy.setPort(proxy.getPort()); mavenProxy.setNonProxyHosts(proxy.getNonProxyHosts()); mavenProxy.setUserName(proxy.getUsername()); mavenProxy.setPassword(proxy.getPassword()); return mavenProxy; } else { return null; } } else { return null; } }