Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.47 KB

other-proxy.md

File metadata and controls

42 lines (34 loc) · 1.47 KB
title
Proxy

By default, coursier relies on java.net.HttpURLConnection to handle HTTP requests. java.net.HttpURLConnection automatically picks up proxy related properties. Typically, https.proxyHost and https.proxyPort need to be set. If the proxy server requires authentication, https.proxyUser and https.proxyPassword must also be set.

CLI

To set one of those properties, run the CLI like

$ java -Dhttps.proxyHost=… -Dhttps.proxyPort=… \
     -jar $(which coursier) [args]

instead of coursier [args]. Alternatively, recent versions of coursier should accept those options prefixed with -J, like

$ coursier -J-Dhttps.proxyHost=… -J-Dhttps.proxyPort=… [args]

sbt

Set those properties when starting sbt, like

$ sbt -Dhttps.proxyHost=… -Dhttps.proxyPort=… [args]

Alternatively, pass those by setting JAVA_OPTS in the environment.

API

Ensure the right Java properties are set when running your application, either from the command line when running your application, via

$ java -Dhttps.proxyHost=… -Dhttps.proxyPort=… [args]

or by setting them yourself before anything coursier is run, like

System.setProperty("https.proxyHost", "…")
System.setProperty("https.proxyPort", "…")