下载maven工件时隐藏HTTP密码
我们有一个密码保护的Maven存储库。下载http密码时,控制台上会显示: Downloading: https://arved:passw0rd@maven.arved.at/content/groups/arved/org/apache/xbean/xbean-naming/3.7/xbean-naming-3.7.jar 下载:https://arved:passw0rd@maven.arved.at/content/groups/arved/org/apache/xbean/xbean-naming/3.7/xbean-naming-3.7.jar下载maven工件时隐藏HTTP密码,maven,buildr,Maven,Buildr,我们有一个密码保护的Maven存储库。下载http密码时,控制台上会显示: Downloading: https://arved:passw0rd@maven.arved.at/content/groups/arved/org/apache/xbean/xbean-naming/3.7/xbean-naming-3.7.jar 下载:https://arved:passw0rd@maven.arved.at/content/groups/arved/org/apache/xbean/xbean-
有可能以某种方式隐藏密码吗?一种方法是使用monkey补丁URI::HTTP。下面的代码可以改进,但显示了总体思路
# Patch HTTP.to_s so it does not reveal passwords
module URI
class HTTP
def to_s
url = ''
if @scheme
url << @scheme
url << ':'
end
if @host
url << '//'
end
if self.userinfo
url << @user
if @password
url << ':***'
end
url << '@'
end
if @host
url << @host
end
if @port
url << ':'
url << @port.to_s
end
url << path_query
if @fragment
url << '#'
url << @fragment
end
url
end
end
end
#将HTTP.to#s补丁,使其不会泄露密码
模块URI
类HTTP
def至美国
url=“”
if@scheme
url您的存储库配置(url)可能错误,请查看此页面:
(加密是可选的)
您只需将密码输入到$HOME/.m2/settings.xml
<settings>
...
<servers>
...
<server>
<id>arved-repository</id>
<username>arved</username>
<password>passw0rd</password>
</server>
...
</servers>
...
</settings>
...
...
arved存储库
阿维德
passw0rd
...
...
并使用先前定义的server.id在pom.xml中配置存储库:
<project>
...
<repositories>
<repository>
<id>arved-repository</id>
<name>Arved Repository</name>
<url>https://maven.arved.at/content/groups/arved</url>
</repository>
...
</project>
...
arved存储库
Arved存储库
https://maven.arved.at/content/groups/arved
...
以前从未见过这种情况。您正在使用哪个版本的Maven以及哪个Maven存储库管理软件?您是如何配置http密码的?