Add support for proxy maven deployment

Summary: This is helpful when uploading snapshots from a devserver.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10008434

fbshipit-source-id: de00acee189e751982f622c0ac317e9c2ea14540
This commit is contained in:
Pascal Hartig
2018-09-24 04:37:54 -07:00
committed by Facebook Github Bot
parent 90cf003035
commit 9685477ea6

View File

@@ -41,6 +41,16 @@ def getRepositoryPassword() {
return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
}
def applyProxy(repo) {
def host = System.getProperty('https.proxyHost')
def port = (System.getProperty('https.proxyPort') ?: '-1').toInteger()
if (host != null && port > 0) {
repo.proxy(host: host, port: port, type: 'http')
repo.proxy(host: host, port: port, type: 'https')
}
}
afterEvaluate { project ->
uploadArchives {
repositories {
@@ -53,9 +63,11 @@ afterEvaluate { project ->
repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
applyProxy(it)
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
applyProxy(it)
}
pom.project {