Skip to content

Commit

Permalink
Fixes #9000: Maven does not honor PROXY settings
Browse files Browse the repository at this point in the history
Generate Maven's proxy setting from template according to PROXY
environment variable being set
  • Loading branch information
Janos Mattyasovszky committed Sep 12, 2016
1 parent 9e0fd20 commit 49adf76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions rudder-webapp/SOURCES/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
MAVEN_RELEASE = 3.0.4
WGET := $(if $(PROXY), http_proxy=$(PROXY) ftp_proxy=$(PROXY)) /usr/bin/wget -q

MAVEN_PROXY := $(if $(PROXY), $(shell echo "$(PROXY)" | perl -ne ' \
if (m|(https?)://(?:([^:@]+)(?::([^@]+))?\@)?([^:/]+)(?::([0-9]+))?|) { \
chomp;
my $$proto = "<protocol>$$1</protocol>"; \
my $$user = defined($$2) ? "<username>$$2</username>" : ""; \
my $$pass = defined($$3) ? "<password><![CDATA[$$3]]></password>" : ""; \
my $$host = "<host>$$4</host>"; \
my $$id = "<id>$$4</id>"; \
my $$port = defined($5) ? "<port>$$5</port>" : ""; \
print "<proxies> <proxy> <active>true</active> $$id $$proto $$user $$pass $$host $$port </proxy> </proxies>"; \
}'))

.DEFAULT_GOAL := localdepends

RUDDER_VERSION_TO_PACKAGE = <put Rudder version or version-snapshot here>
Expand All @@ -37,6 +49,7 @@ localdepends: ./rudder-sources ./maven/bin/mvn ./rudder-users.xml ./rudder-doc .
tar -xzf ./maven.tgz -C .
rm -rf ./maven
mv ./apache-maven-$(MAVEN_RELEASE) ./maven
sed 's|<!--PROXY-->|$(MAVEN_PROXY)|g' ./settings-external.xml.tpl > ./settings-external.xml

./rudder-sources.tar.bz2:
$(WGET) -O rudder-sources.tar.bz2 http://www.rudder-project.org/archives/rudder-sources-${RUDDER_VERSION_TO_PACKAGE}.tar.bz2
Expand Down Expand Up @@ -66,6 +79,7 @@ localclean:
rm -rf ./rudder-sources
rm -rf ./rudder-doc
rm -rf ./.gitignore
rm -rf ./settings-external.xml

veryclean:
rm -f ./rudder-sources.tar.bz2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
<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">
<localRepository>/tmp/m2-repository</localRepository>
<!--PROXY-->
</settings>

0 comments on commit 49adf76

Please sign in to comment.