在Jenkinsfile中使用jenkins修改pom时出错

时间:2017-12-14 10:27:29

标签: maven jenkins pom.xml jenkins-pipeline

在Jenkinsfile中,我想通过修改pom.xml添加报告配置:

def pom = readMavenPom file: 'pom.xml'
reporting = new org.apache.maven.model.Reporting();
def reportPlugin =  new ReportPlugin();
reportPlugin.setGroupId('org.apache.maven.plugins');
....
pom.setReporting(reporting);

然后错误报告:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.apache.maven.model.Model.setReporting() is applicable for argument types: (org.apache.maven.model.Reporting) values: [org.apache.maven.model.Reporting@5ef6c603]
Possible solutions: setReporting(org.apache.maven.model.Reporting), getReporting(), setReports(java.lang.Object), getReports()
The following classes appear as argument class and as parameter class, but are defined by different class loader:
org.apache.maven.model.Reporting (defined by 'AntClassLoader[/jenkins/plugins/maven-plugin/WEB-INF/lib/aether-api-1.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/aether-connector-basic-1.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/aether-impl-1.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/aether-spi-1.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/aether-transport-wagon-1.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/aether-util-1.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/ant-1.9.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/ant-launcher-1.9.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/cdi-api-1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/commons-cli-1.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/commons-io-2.5.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/commons-net-3.5.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/doxia-sink-api-1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/findbugs-annotations-1.3.9-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jackrabbit-webdav-2.14.1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/javax.inject-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jna-platform-4.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.connector-factory-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.core-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.jsch-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.pageant-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.sshagent-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.usocket-jna-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsch.agentproxy.usocket-nc-0.0.9.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsoup-1.7.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/jsr250-api-1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/lib-jenkins-maven-artifact-manager-1.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/lib-jenkins-maven-embedder-3.12.1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-aether-provider-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-artifact-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-compat-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-core-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-embedder-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-model-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-model-builder-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-plugin-api-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-plugin.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-reporting-api-3.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-repository-metadata-3.5.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-settings-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-settings-builder-3.1.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven2.1-interceptor-1.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven33-agent-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven33-interceptor-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.12-alpha-1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/org.eclipse.sisu.inject-0.3.3.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/org.eclipse.sisu.plexus-0.3.3.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-cipher-1.7.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-classworlds-2.5.2.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-component-annotations-1.7.1.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-interactivity-api-1.0-alpha-6.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-interpolation-1.16.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-sec-dispatcher-1.3.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/plexus-utils-3.0.24.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-file-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-ftp-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-http-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-http-shared-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-provider-api-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-ssh-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-ssh-common-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-ssh-external-3.0.0.jar:/jenkins/plugins/maven-plugin/WEB-INF/lib/wagon-webdav-jackrabbit-3.0.0.jar]' and 'AntClassLoader[/jenkins/plugins/pipeline-utility-steps/WEB-INF/lib/pipeline-utility-steps.jar:/jenkins/plugins/pipeline-utility-steps/WEB-INF/lib/plexus-utils-3.0.22.jar:/jenkins/plugins/pipeline-utility-steps/WEB-INF/lib/commons-lang3-3.4.jar:/jenkins/plugins/pipeline-utility-steps/WEB-INF/lib/maven-model-3.3.9.jar]')
If one of the method suggestions matches the method you wanted to call,
    then check your class loader setup.

有谁知道问题是什么?

0 个答案:

没有答案