繁体   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