Search code examples
jenkinsjenkins-pipeline

Jenkins error while setting build parameters from Jenkinsfile


I am trying to set build parameter (String and password param) from the Jenkinsfile but I am getting following error and the build fails.

Caused by: java.lang.UnsupportedOperationException: PasswordParameterDefinition as a class hudson.model.ParameterDefinition could mean either hudson.model.PasswordParameterDefinition or com.michelin.cio.hudson.plugins.passwordparam.PasswordParameterDefinition
    at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:419)

Solution

  • Copy/pasted from https://issues.jenkins-ci.org/browse/JENKINS-18141:

    In the example above, the DSL tries to find a subclass of hudson.model.ParameterDefinition named PasswordParameterDefinition. In your installation there are two classes named PasswordParameterDefinition, one defined by Jenkins itself and one provided by the Mask Passwords Plugin. The DSL can't decide which to use, so it generates the error. If you have installed the Mask Passwords Plugin, you can use nonStoredPasswordParam to create a password parameter: https://jenkinsci.github.io/job-dsl-plugin/#path/job-parameters-nonStoredPasswordParam