8000 GitHub - martijndwars/proxy-gradle-plugin: Make Gradle use the web proxy based on the HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

martijndwars/proxy-gradle-plugin

Repository files navigation

Proxy Gradle Plugin

Many corporate networks require outbound traffic to be routed through a proxy server. Unix tools like curl and wget use the environment variables http_proxy, https_proxy, and no_proxy to control whether traffic is routed through the proxy. The JVM, however, implements its own networking and proxy mechanism that relies on Java system properties. System properties are awkward to use, because you cannot easily set/unset them globally. With this plugin Gradle will behave similar to curl and wget, i.e. it will use the proxy based on http_proxy, https_proxy, and no_proxy variables.

Usage

To make the plugin part of your init script, add the following to ~/.gradle/init.gradle.kts:

initscript {
  repositories {
    maven {
      url = uri("https://plugins.gradle.org/m2")
    }
  }
  dependencies {
    classpath("nl.martijndwars:proxy-gradle-plugin:1.0.1")
  }
}

apply<nl.martijndwars.proxy.ProxyGradlePluginPlugin>()

Set the proxy environment variable (e.g. HTTP_PROXY=http://proxy.acme.com:80) and run Gradle; Gradle now uses the proxy server. If you leave the corporate network, unset the environment variable (e.g. unset HTTP_PROXY) and run Gradle; Gradle now no longer uses the proxy server. Enjoy!

About

Make Gradle use the web proxy based on the HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables.

Resources

Stars

Watchers

Forks

Packages

No packages published
0