maven-2 – 訪問需要基本認證的工件/ Maven Repo
我有一個藝術品回購,落後於基本認證.我如何配置settings.xml以允許訪問?
<mirrors> <mirror> <id>artifactory</id> <mirrorOf>*</mirrorOf> <url>https://myserver.example.com/artifactory/repo</url> <name>Artifactory</name> </mirror> </mirrors> <servers> <!-- This server configuration gives your personal username/password for artifactory. Note that the server id must match that given in the mirrors section. --> <server> <id>Artifactory</id> <username>someArtifactoryUser</username> <password>someArtifactoryPassword</password> </server>
所以伺服器標籤是使用者的使用者憑據,但是我還需要提供另一個使用者/密碼來通過基本認證.我該怎麼辦?
我建議您將伺服器設定放在使用者設定中,而不是全域性設定.您還可以加密Maven 2.1.0中的密碼,有關詳細資訊,請參閱ofollow,noindex" target="_blank">mini guide .
更新:您正在使用什麼版本的Artifactory?基本認證失敗了Windows-XP-host-but-artifactory-can't-td23436279.html" rel="nofollow,noindex" target="_blank">a discussion 和issue .這顯然在2.0.7和2.1.0中被修正.
從討論來看,workaround 似乎是通過命令列傳遞屬性,例如.
-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080 -Dproxy.username=... -Dhttp.password=...
更新:要讓Maven安裝通過防火牆連線,您需要配置settings.xml的代理部分,有關這方面的指導,請參閱此question .
Update2:您可以在伺服器設定中設定其他屬性,有關某些背景資訊,請參閱此blog .我沒有機會測試這個,但從部落格和相關的http wagon javadoc ,似乎可以在伺服器設定上設定authenticationInfo,如下所示:
<server> <id>Artifactory</id> <username>someArtifactoryUser</username> <password>someArtifactoryPassword</password> <configuration> <authenticationInfo> <userName>auth-user</userName> <password>auth-pass</password> </authenticationInfo> </configuration> </server>
http://stackoverflow.com/questions/1280747/accessing-an-artifactory-maven-repo-that-requires-basic-auth