Gradle plugin for building Fn Project functions
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Bump copyright to 2019 Jan 13, 2019
gradle/wrapper Fix codenarc issues Jan 13, 2019
src/main Update to JDK 11 Jan 17, 2019
.travis.yml Add travis config Jan 13, 2019
Jenkinsfile Initial import Oct 10, 2018
LICENSE Update Dec 18, 2018
build.gradle Fix codenarc issues Jan 13, 2019
gradlew Fix codenarc issues Jan 13, 2019

Fn Gradle Plugin

The Fn Gradle plugin allows you to easily build functions with Java, Groovy or Kotlin for deploying to your Fn Project ( server.

The plugin provides helpers for creating a function, building the docker image and deploying it to the server. Under the hood the plugin uses the Fn CLI ( to perform the actions.

Build Status Latest Release License

Getting started

The only requirement to use the Gradle plugin is to install docker on your local machine. Once you have that done you can continue with the tutorial.

Now lets create a new project:

In a terminal create a new folder and in that folder create a build.gradle file with the following contents:

plugins {
  id 'groovy'
  id 'com.devsoap.fn' version '0.1'

version = '1.0.0'

repositories {

dependencies {
   compile group: 'org.codehaus.groovy', name: 'groovy', version: '2.5.2'

fn {
  functionClass = 'com.example.fn.MyFunction'
  functionMethod = 'handleRequest'

Now you are ready to create the function. Next do the following:

In the console type:

gradle fnCreateFunction

You should now have the following project structure:

├── build.gradle
└── src
    └── main
        └── groovy
            └── com
                └── example
                    └── fn
                        └── MyFunction.groovy

6 directories, 2 files

Start your FN server with by running gradle fnStart to start the fn server locally.

Once the Fn server is running we can deploy our function there, in the project folder execute the following command to package our function in a docker image and deploy it:

gradle fnDeploy

If everything went well we can now invoke our function with

gradle fnInvoke

or if you want to provide some input to the function with

gradle fnInvoke --input=John

Development tip: If you are developing run gradle -t fnInvoke instead. While that is running you can change the source code and Gradle will auto-deploy a new version after every change and invoke it so you can immediately see the function result after the change.

Development tip: You can pass headers to the function by using --headers=X-foo=bar,X-Other=Baz.

Development tip: You can pass query parameters to the function by using --params=foo=bar,other=baz `

If you want to use a browser instead, you can access the function url at http://localhost:8080/t/<functionName>/<functionName>.


Support this project by becoming a sponsor. Your logo will show up here with a link to your website. To find out more about becoming a sponsor see the Become a sponsor page.


This plugin is distributed under the Apache License 2.0 license. For more information about the license see the LICENSE file in the root directory of the repository. A signed CLA is required when contributing to the project.