com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig Java Examples
The following examples show how to use
com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeliumBundleFactory.java From zeppelin with Apache License 2.0 | 6 votes |
private ProxyConfig getProxyConfig(boolean isSecure) { List<ProxyConfig.Proxy> proxies = new LinkedList<>(); String httpProxy = StringUtils.isBlank(System.getenv("http_proxy")) ? System.getenv("HTTP_PROXY") : System.getenv("http_proxy"); String httpsProxy = StringUtils.isBlank(System.getenv("https_proxy")) ? System.getenv("HTTPS_PROXY") : System.getenv("https_proxy"); try { if (isSecure && StringUtils.isNotBlank(httpsProxy)) proxies.add(generateProxy("secure", new URI(httpsProxy))); else if (!isSecure && StringUtils.isNotBlank(httpProxy)) proxies.add(generateProxy("insecure", new URI(httpProxy))); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } return new ProxyConfig(proxies); }
Example #2
Source File: HeliumBundleFactory.java From zeppelin with Apache License 2.0 | 6 votes |
private ProxyConfig.Proxy generateProxy(String proxyId, URI uri) { String protocol = uri.getScheme(); String host = uri.getHost(); int port = uri.getPort() <= 0 ? 80 : uri.getPort(); String username = null, password = null; if (uri.getUserInfo() != null) { String[] authority = uri.getUserInfo().split(":"); if (authority.length == 2) { username = authority[0]; password = authority[1]; } else if (authority.length == 1) { username = authority[0]; } } String nonProxyHosts = StringUtils.isBlank(System.getenv("no_proxy")) ? System.getenv("NO_PROXY") : System.getenv("no_proxy"); return new ProxyConfig.Proxy(proxyId, protocol, host, port, username, password, nonProxyHosts); }
Example #3
Source File: MojoUtils.java From frontend-maven-plugin with Apache License 2.0 | 6 votes |
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); } }
Example #4
Source File: InstallNodeAndYarnMojo.java From frontend-maven-plugin with Apache License 2.0 | 6 votes |
@Override public void execute(FrontendPluginFactory factory) throws InstallationException { ProxyConfig proxyConfig = MojoUtils.getProxyConfig(this.session, this.decrypter); Server server = MojoUtils.decryptServer(this.serverId, this.session, this.decrypter); if (null != server) { factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot) .setNodeVersion(this.nodeVersion).setPassword(server.getPassword()) .setUserName(server.getUsername()).install(); factory.getYarnInstaller(proxyConfig).setYarnDownloadRoot(this.yarnDownloadRoot) .setYarnVersion(this.yarnVersion).setUserName(server.getUsername()) .setPassword(server.getPassword()).install(); } else { factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot) .setNodeVersion(this.nodeVersion).install(); factory.getYarnInstaller(proxyConfig).setYarnDownloadRoot(this.yarnDownloadRoot) .setYarnVersion(this.yarnVersion).install(); } }
Example #5
Source File: MojoUtils.java From wisdom with Apache License 2.0 | 6 votes |
public 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<>(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())); } } return new ProxyConfig(proxies); } }
Example #6
Source File: BowerMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
private ProxyConfig getProxyConfig() { if (bowerInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("bower not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
Example #7
Source File: NpmMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
@Override public synchronized void execute(FrontendPluginFactory factory) throws TaskRunnerException { File packageJson = new File(workingDirectory, "package.json"); if (buildContext == null || buildContext.hasDelta(packageJson) || !buildContext.isIncremental()) { ProxyConfig proxyConfig = getProxyConfig(); factory.getNpmRunner(proxyConfig, getRegistryUrl()).execute(arguments, environmentVariables); } else { getLog().info("Skipping npm install as package.json unchanged"); } }
Example #8
Source File: NpmMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
private ProxyConfig getProxyConfig() { if (npmInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("npm not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
Example #9
Source File: YarnMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
@Override public synchronized void execute(FrontendPluginFactory factory) throws TaskRunnerException { File packageJson = new File(this.workingDirectory, "package.json"); if (this.buildContext == null || this.buildContext.hasDelta(packageJson) || !this.buildContext.isIncremental()) { ProxyConfig proxyConfig = getProxyConfig(); factory.getYarnRunner(proxyConfig, getRegistryUrl()).execute(this.arguments, this.environmentVariables); } else { getLog().info("Skipping yarn install as package.json unchanged"); } }
Example #10
Source File: YarnMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
private ProxyConfig getProxyConfig() { if (this.yarnInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(this.session, this.decrypter); } else { getLog().info("yarn not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
Example #11
Source File: InstallNodeAndNpmMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
@Override public void execute(FrontendPluginFactory factory) throws InstallationException { ProxyConfig proxyConfig = MojoUtils.getProxyConfig(session, decrypter); String nodeDownloadRoot = getNodeDownloadRoot(); String npmDownloadRoot = getNpmDownloadRoot(); Server server = MojoUtils.decryptServer(serverId, session, decrypter); if (null != server) { factory.getNodeInstaller(proxyConfig) .setNodeVersion(nodeVersion) .setNodeDownloadRoot(nodeDownloadRoot) .setNpmVersion(npmVersion) .setUserName(server.getUsername()) .setPassword(server.getPassword()) .install(); factory.getNPMInstaller(proxyConfig) .setNodeVersion(nodeVersion) .setNpmVersion(npmVersion) .setNpmDownloadRoot(npmDownloadRoot) .setUserName(server.getUsername()) .setPassword(server.getPassword()) .install(); } else { factory.getNodeInstaller(proxyConfig) .setNodeVersion(nodeVersion) .setNodeDownloadRoot(nodeDownloadRoot) .setNpmVersion(npmVersion) .install(); factory.getNPMInstaller(proxyConfig) .setNodeVersion(this.nodeVersion) .setNpmVersion(this.npmVersion) .setNpmDownloadRoot(npmDownloadRoot) .install(); } }
Example #12
Source File: NpxMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
@Override public void execute(FrontendPluginFactory factory) throws TaskRunnerException { File packageJson = new File(workingDirectory, "package.json"); if (buildContext == null || buildContext.hasDelta(packageJson) || !buildContext.isIncremental()) { ProxyConfig proxyConfig = getProxyConfig(); factory.getNpxRunner(proxyConfig, getRegistryUrl()).execute(arguments, environmentVariables); } else { getLog().info("Skipping npm install as package.json unchanged"); } }
Example #13
Source File: NpxMojo.java From frontend-maven-plugin with Apache License 2.0 | 5 votes |
private ProxyConfig getProxyConfig() { if (npmInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("npm not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
Example #14
Source File: BowerMojo.java From frontend-maven-plugin with Apache License 2.0 | 4 votes |
@Override protected synchronized void execute(FrontendPluginFactory factory) throws TaskRunnerException { ProxyConfig proxyConfig = getProxyConfig(); factory.getBowerRunner(proxyConfig).execute(arguments, environmentVariables); }
Example #15
Source File: NodeManager.java From wisdom with Apache License 2.0 | 4 votes |
/** * @return the proxy settings for NPM execution. */ public ProxyConfig proxy() { return MojoUtils.getProxyConfig(mojo.session, mojo.decrypter); }