添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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!

Similar issue as I would have expected: WorkflowScript: 118: Invalid parameter "command", did you mean "tasks"? @ line 118, column 24. gradle command: "-PtestEnv=stage --continue testResourceIntegration" – Sebastian Sep 16, 2019 at 15:10 Try wrapping your gradle method call inside a script {} block. That is required anyway for global var method invokes and may be your only issue. – Matt Schuchard Sep 16, 2019 at 16:03

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.