jenkinsci / jenkinsci/workflow-cps-plugin

[JENKINS-38945] Pipeline script doesn't find method with explicit parameter type

Open
#1,237 3 comments 0 reactions 0 assignees View on GitHub
component:script-security-plugin component:workflow-cps-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
186
Forks
213
Avg merge
12h 12m
Merged PRs (30d)
8

Description

Pipeline scripts fail to find method declaring parameter type. The script below will fail to execute "doStuff", with NoSuchMethodError.

This used to work, but rolling back security and groovy didn't help, and utility steps (which defines readMavenPom) wasn't available for rollback. On a simple test, "Integer n" works as a type parameter, so this might well be specific to the object returned by readMavenPom().

import org.apache.maven.model.Model

stage ("initial") {
node ('mesos') {

git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'

Model pom = readMavenPom()

echo "Class of pom is ${pom.class}"

doThings(pom)

doStuff(pom)
}
}

def doThings(pom) {
echo "Got something"
}

def doStuff(Model pom) {
echo "Got pom"
}

---
Originally reported by dcsobral, imported from: Pipeline script doesn't find method with explicit parameter type


  • status: Open
  • priority: Minor
  • component(s): script-security-plugin, workflow-cps-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-07

Raw content of original issue

Pipeline scripts fail to find method declaring parameter type. The script below will fail to execute "doStuff", with NoSuchMethodError.

This used to work, but rolling back security and groovy didn't help, and utility steps (which defines readMavenPom) wasn't available for rollback. On a simple test, "Integer n" works as a type parameter, so this might well be specific to the object returned by readMavenPom().


import org.apache.maven.model.Model

stage ("initial") {
node ('mesos') {

git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'

Model pom = readMavenPom()

echo "Class of pom is ${pom.class}"

doThings(pom)

doStuff(pom)
}
}

def doThings(pom) {
echo "Got something"
}

def doStuff(Model pom) {
echo "Got pom"
}


environment

```
Jenkins 2.23

Pipeline 2.4

Pipeline: Groovy 2.19

Script Security 1.23
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.