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?

1 Answer 1


# 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 and acknowledge you have read our privacy policy.

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