简体   繁体   English

将全局 maven settings.xml 外部化到数据库?

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

My maven settings xml file basically declares a bunch of repo locations to search for artifacts.我的 Maven 设置 xml 文件基本上声明了一堆 repo 位置来搜索工件。 I want to centralize this so that i know that all developers, build slaves, etc. Are using the same build profile when building artifacts for the project.我想集中它,以便我知道所有开发人员、构建从属等。在为项目构建工件时使用相同的构建配置文件。 Is there a plugin to do this and if not, what is the best way to setup a plugin to do this?有没有插件可以做到这一点,如果没有,设置插件来做到这一点的最佳方法是什么? Something like below?像下面这样的? What is the phase/goal when settings is loaded?加载设置时的阶段/目标是什么? Assuming i can inject additional information using http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/ can someone suggest a good approach to solving this?假设我可以使用http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/注入额外的信息,有人可以提出解决这个问题的好方法吗?

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

I would keep it simple.我会保持简单。 If you have a well set up nexus/artifactory, then all you will need in your settings.xml is something like :如果您的 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>

This is not an answer:这不是答案:

The first problem I see in your question is that you are mixing things.我在你的问题中看到的第一个问题是你在混合东西。 The settings.xml should contain only a default configuration to access a repository manager and not many repositories. settings.xml应该只包含访问存储库管理器的默认配置,而不是很多存储库。 This is smell at first.这是最初的气味。 Secondly if you need to define some kind of profiles there is another smell.其次,如果您需要定义某种配置文件,还有另一种气味。 You should use at least no profile.您至少应该不使用配置文件。 Furthermore in the settings.xml there can be username/passwords (encrypted best) etc. on a user base which should be located in users home.此外,在settings.xml ,用户名/密码(最好加密)等应该位于用户家中。 On Jenkins you can use the config file provider to solve that in a general good way.在 Jenkins 上,您可以使用配置文件提供程序以一般的好方法解决该问题。

Apart from that what is the relationship to Plugins ?除此之外与 Plugins 有什么关系? Why loading the settings.xml in plugin?为什么在插件中加载 settings.xml? For what purpose?出于什么目的? Unfortunately you are very general but do not explain your real problem ?不幸的是,你很笼统,但没有解释你真正的问题? And what kind of you are trying to solve?你想解决什么样的问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM