Writing a jenkins plugin in groovy is simple and elegant. I have used gradle as a build tool.

git clone https://github.com/ageekymonk/jenkins-helloworld-groovy-plugin
  ./gradlew build