1

I'm using vim to write Jenkinsfile which has a groovy synatx.

node {
  // Jenkins stuff to do
}

In order to force groovy syntax on a file without .groovy extension I added

# vi: ft=groovy

To the top of the file.

While this works in vim - Jenkins has issues treating this as groovy script and throws a syntax error.

Is there a way to work around this?

3

# isn't how you write a comment in Groovy, so you've created a file with incorrect syntax. Change it to a proper Groovy comment and you should be fine.

// vi: ft=groovy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.