Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Forked from FeodorFitsner/set-maven-proxy.ps1
Last active July 25, 2016 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaFinkelshteyn/27396bd0f92a8f118632fdcaa1ff6c00 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/27396bd0f92a8f118632fdcaa1ff6c00 to your computer and use it in GitHub Desktop.
Setup Maven builds to use AppVeyor HTTP proxy
if(-not $env:APPVEYOR_HTTP_PROXY_IP) { return }
$mavenConfig = '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>' + $env:APPVEYOR_HTTP_PROXY_IP + '</host>
<port>' + $env:APPVEYOR_HTTP_PROXY_PORT + '</port>
</proxy>
</proxies>
</settings>'
New-Item "$env:USERPROFILE\.m2" -ItemType Directory -Force | Out-Null
Set-Content "$env:USERPROFILE\.m2\settings.xml" -Value $mavenConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment