簡體   English   中英

如果 nexus 服務器關閉,如何配置 maven 以訪問 maven 中心?

[英]How do I configure maven to access maven central if nexus server is down?

我想設置我的構建,使其自動嘗試從 maven 中央下載工件,如果我們的連接服務器無法訪問。 我在 settings.xml 中有以下內容,但我不確定如何更改它(如果可能的話)。

<profiles>
<profile>
 <id>nexus</id>
 <!--Enable snapshots for the built in central repo to direct -->
 <!--all requests to nexus via the mirror -->
 <repositories>
   <repository>
     <id>central</id>
     <url>http://mynexus</url>
     <releases><enabled>true</enabled></releases>
     <snapshots><enabled>true</enabled></snapshots>
   </repository>
 </repositories>
 <pluginRepositories>
   <pluginRepository>
     <id>central</id>
     <url>http://mynexus</url>
     <releases><enabled>true</enabled></releases>
     <snapshots><enabled>true</enabled></snapshots>
   </pluginRepository>
 </pluginRepositories>
</profile>
</profiles>

<activeProfiles>
   <activeProfile>nexus</activeProfile>
</activeProfiles>

為了使用存儲庫管理器(包括 Nexus),您需要定義一個 mirrorOf * 元素,它將攔截所有存儲庫 url 並將它們發送到 Nexus 進行解析。 在 Maven2 和 3 中,無法在配置文件中配置 mirrorOf 元素。 這意味着沒有簡單的方法來回翻轉而不更改您的設置。

您需要注釋掉鏡像部分,然后停用 Nexus 配置文件以使 Maven 恢復為標准行為。

幸運的是,雖然 Nexus 非常穩定,但它永遠不會停止 go。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM