如何从声明性管道 rtMavenRun 中调用 Maven 原型生成

问题描述

我们最近将我们的 Jenkins 从一个特定的服务器迁移到了 AWS 托管的 Jenkins,我们可以在那里将凭证持久化。因此,每次运行我们都必须通过设置 MAVEN_RESOLVER 来准备工件,并且我们必须让我们的 mvn 构建步骤在 rtMavenRun 块中运行。

我们有一个用于生成基础存储库的原型,以前我们只是在 Jenkinsfile 的 shell 块中调用它来原型:生成文件。但是,现在我们必须在 rtMavenRun 块内的 Jenkinsfile 中进行 maven 调用,我们必须在那里有一个 pom 文件,因为 pom 文件是 rtMavenRun 块的必需参数,因此调用失败,因为没有 pom。

                    rtMavenRun(
                        tool: "3.6.3",// Tool name from Jenkins configuration
                        pom: "pom.xml",goals: "-B archetype:generate",opts: "-DarchetypeGroupId=com.x.y.archetype -DarchetypeArtifactId=game-components -DarchetypeVersion=${componentsArchetypeVersion} -DgroupId=com.z.y.${contentUnitLower} -DartifactId=${contentUnitLower}-${gameNameDash}-components -Dpackage=com.x.y.z.${contentUnitLower}.${gameNameLower} -Dversion=1.0.0-SNAPSHOT -Dcontentunit=${contentUnitLower} -Dgame-name=${gameNameDash} -DGameName=${gameNameCaps} -dspacedGameName=\\\\\\\\\\\"${params.gameName}\\\\\\\\\\\" -Dgamename=${gameNameLower}",resolverId: "MAVEN_RESOLVER"
                )

以上是我尝试过但不起作用的方法。 以下是它曾经在我们的旧服务器上的工作方式,该服务器托管在一个空目录中:

sh "mvn archetype:generate -B  -DarchetypeGroupId=com.x.y.archetype -DarchetypeArtifactId=game-components -DarchetypeVersion=${componentsArchetypeVersion} -DgroupId=com.x.y.${contentUnitLower} -DartifactId=${contentUnitLower}-${gameNameDash}-components -Dpackage=com.x.y.z.${contentUnitLower}.${gameNameLower} -Dversion=1.0.0-SNAPSHOT -Dcontentunit=${contentUnitLower} -Dgame-name=${gameNameDash} -DGameName=${gameNameCaps} -dspacedGameName=\"${params.gameName}\" -Dgamename=${gameNameLower}"
            

有没有人有在云托管的声明式 Jenkins 管道中运行原型的经验,可以提出一些解决方案?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)