Jenkins : Scala Hello World Plugin

Plugin Information

No information for the plugin 'scala-hello-world' is available. It may have been removed from distribution.

Hello World Plugin built in Scala


This plugin is a proof of concept for building plugins in Scala. It reimplements the standard hello world plugin

There is a Java shim but the main functionality is Scala.

The plugin is built with gradle

./gradlew server

Techie Detail

The main techie detail is to apply Java compile annotation processing to Scala code. This is the sezpoz annotation processing which creates a file of plugin descriptors.

The bit in gradle is this

task annotate(dependsOn:compileScala, type: Exec)  {

    if (logging.level >= LogLevel.INFO) {
        args '-verbose'

        args '-proc:only'
        args '-d'
        args compileJava.destinationDir
        args '-classpath'
        args compileJava.classpath.getAsPath() + + compileJava.destinationDir

        if (logging.level >= LogLevel.INFO) {
            args '-verbose'

        fileTree(compileScala.destinationDir).each { File file ->
            if(file.path.contains('META-INF')) {
            if(!file.path.endsWith('class')) {
            args file.path.minus(compileScala.destinationDir).minus('.class').substring(1).replaceAll(File.separator,'.')

    executable "javac"

compileScala.doLast {annotate.execute()}

This will iterate all the class files built from scala and run the preprocessors on them. This is complicated as class files must have the `.class` removed 

The scala gradle plugin is also used.


* split the java and scala pieces

* write some tests

* the java shim splits out the scala functions to separate functions as the java paramaterizing didn't fit the scala parameterizing

* make the code more functional