I have a shared library for a project specific Jenkins Setup.
One of my files in vars/gradle.groovy
looks as follows:
/**
* simple wrapper around the ./gradlew command in a repository.
*
*
* @param command : the gradle command that will be executed.
*
* @return nothing, except for status codes.
*/
void call(String command) {
sh "./gradlew ${command}"
}
return this
When I try to call it from my actual project code (declarative Jenkinsfile) like this:
...
stage('Gradle Build + Docker Build (against remote DB)') {
steps {
gradle "-PtestEnv=stage --continue build"
}
}
...
I get the following error:
WorkflowScript: 97: Step does not take a single required parameter - use named parameters instead @ line 97, column 17.
gradle "-PtestEnv=stage --continue build"
Any ideas what I'm doing wrong? Other functions use named parameters, and they work out of the box.
But in this case I would prefer a simple String
parameter to make the interface of the method as convenient as possible.
Thanks!