我有一个 jenkins 文件,它正在加载一个 groovy 脚本,并想在 groovy 中使用 config-file-provider 插件。我阅读了添加支持的文档,但不知道如何在运行 mvn clean install -s settings.xml 时使用 groovy 添加它以使用特定的 settings.xml 文件。看起来此列表支持此插件-> https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md
想知道您是否找到了答案,带有 groovy(用于管道的 groovy)的 maven 示例实际上记录在插件页面中,这里:
node {
git url: 'https://github.com/spring-projects/spring-petclinic.git'
// install Maven and add it to the path
env.PATH = "${tool 'M3'}/bin:${env.PATH}"
configFileProvider(
[configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn -s $MAVEN_SETTINGS clean package'
}
}
Run Code Online (Sandbox Code Playgroud)
我只是尝试在我的管道中放置一个类似的块,在一个阶段步骤中,它起作用了。请注意,在上面的示例中,MAVEN_SETTINGS是临时 XML 文件的路径。maven-settings是通过配置文件提供程序插件创建的文件的 ID。
| 归档时间: |
|
| 查看次数: |
14803 次 |
| 最近记录: |