如何使用docker.image提供托pipe文件到Jenkins版本?

我正在尝试使用Jenkinspipe道来构build一个Maven Java项目,并将其构件部署到Nexus中。 Nexus凭证由Jenkinspipe理,所以我需要Jenkins提供Maven settings.xml文件。 我的pipe道使用docker运行构build。 我的Jenkinsfile如下所示:

 node('docker') { git 'git@bitbucket.org:myorg/myproject.git' stage 'Build and Test' // This throws: java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.InvokerInvocationException for security reasons //configFileProvider([configFile(fileId: '7d6efcd2-ff3d-43dc-be40-898dab2bff64', variable: 'MYSETTINGS')]) { // sh 'cp ${MYSETTINGS} mysettings.xml' // } docker.image('maven:3.3.9').inside { // sh 'mvn -s mysettings.xml -U -e clean deploy' // This fails trying to access AWS ECR (???) withMaven(mavenSettingsConfig: '7d6efcd2-ff3d-43dc-be40-898dab2bff64') { sh 'mvn -U -e clean deploy' } } 

到目前为止,我无法提供正确的maven设置。 withMaven有一些“知道限制”(Maven Pipeline Plugin, https: //wiki.jenkins-ci.org/display/JENKINS/Pipeline+Maven+Plugin)

有没有解决方法? 我试图使用configFileProvider,但由于安全原因它抛出UnsupportedOperationException。