【问题标题】:Maven inject plugin settings.xmlMaven 注入插件 settings.xml
【发布时间】:2018-11-26 14:45:18
【问题描述】:

我目前正在为多个项目设置 CI/CD 链。我想在我们的 Jenkins 服务器的每个构建中注入一个 maven 插件(这个:https://github.com/cedricwalter/git-branch-renamer-maven-plugin)。有没有办法将插件注入构建而不将其添加到每个项目中的每个 pom.xml 中?

【问题讨论】:

  • 可以在父pom中添加插件。

标签: maven jenkins maven-plugin


【解决方案1】:

您可以通过 mavenSettings.xml 使用 profile 部分来做到这一点:https://maven.apache.org/settings.html

然后将 mavenSettings.xml 设置为 Jenkins 使用的 Maven 安装。

  ...
  <profiles>
    <profile>
      <id>AllwaysOn</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        ...
      </activation>

      <!-- add plugin config here -->
    </profile>
  </profiles>
  ...

然后你可以在那里添加你的特定插件配置。

【讨论】:

  • 在您的代码 sn-p 本身中显示该配置的示例会更有帮助,而不是注释存根。
  • 没有可用于 maven 的 mavenSettings.xml 文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-03-19
  • 2016-10-21
  • 2012-04-19
  • 1970-01-01
  • 1970-01-01
  • 2017-10-07
  • 1970-01-01
相关资源
最近更新 更多