簡體   English   中英

將全局 maven settings.xml 外部化到數據庫?

[英]externalize global maven settings.xml to a database?

我的 Maven 設置 xml 文件基本上聲明了一堆 repo 位置來搜索工件。 我想集中它,以便我知道所有開發人員、構建從屬等。在為項目構建工件時使用相同的構建配置文件。 有沒有插件可以做到這一點,如果沒有,設置插件來做到這一點的最佳方法是什么? 像下面這樣的? 加載設置時的階段/目標是什么? 假設我可以使用http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/注入額外的信息,有人可以提出解決這個問題的好方法嗎?

<executions>
   <execution>
           <id>bootstrap</id>
           <phase>initialize</phase>
           <goals>
                   <goal></goal>
           </goals>
   </execution>
</executions>

我會保持簡單。 如果您的 nexus/artifactory 設置得很好,那么您在 settings.xml 中所需要的只是以下內容:

<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
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">

   <mirrors>
     <mirror>
          <id>internalmirror</id>
          <mirrorOf>*</mirrorOf>
          <url>https://path to virtual repo combing other repos/</url>
      </mirror>
  </mirrors>

</settings>

這不是答案:

我在你的問題中看到的第一個問題是你在混合東西。 settings.xml應該只包含訪問存儲庫管理器的默認配置,而不是很多存儲庫。 這是最初的氣味。 其次,如果您需要定義某種配置文件,還有另一種氣味。 您至少應該不使用配置文件。 此外,在settings.xml ,用戶名/密碼(最好加密)等應該位於用戶家中。 在 Jenkins 上,您可以使用配置文件提供程序以一般的好方法解決該問題。

除此之外與 Plugins 有什么關系? 為什么在插件中加載 settings.xml? 出於什么目的? 不幸的是,你很籠統,但沒有解釋你真正的問題? 你想解決什么樣的問題?

暫無
暫無

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

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