NetKernel Gradle Plugin
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A Gradle Plugin for building NetKernel modules.

Generous Gradle guidance provided by @tlberglund (

More documentation is coming soon, but for now:

1) Install Gradle (

2) From this directory, run:

gradle install

This will install the plugin into a local Maven repository in your home directory. You do 
not need Maven installed for this to happen.

3) In your $HOME/.gradle/ file put at least the following:


This should point to a NetKernel installation. Future support will allow you to 
download NetKernel as part of the build. If you have NetKernel running, the build
system will find it and where it is installed, but you'll probably want to add
the property as above.

4) The minimum you need to add to your NetKernel module is a file called build.gradle that looks
like the following:

apply plugin: 'netkernel'

dependencies {
	groovy localGroovy()

buildscript {
	repositories {
	dependencies {
        classpath group: 'net.bosatsu.gradle', name: 'nk-gradle-plugin', version: '0.0.13'

You should now be able to say:

gradle clean        ; cleans the build dir
gradle nkpackage    ; compiles any Java/Groovy code, generates a module and builds a deployable
                    ; package with default settings
The module file itself will be put into build/modules. The package will be in build/packages.

If you want to compile "in place", add the directory to NetKernel's etc/modules.xml and you 
should be able to do:

gradle compileGroovy    ; compiles both Groovy and Java code found in the module

4) If you want to create an Apposite Repository, you will need the following as well

a) Generate a keystore:


For now, use the same password for the keystore and the key.

b) Add the following to your $HOME/.gradle/

netkernelpubname=A name for the repo
netkernelpubdescr=A description of the repo

c) Add something like the following to your module's build.gradle after the apply:

nkconfig {
	definePackage(name: 'package-a', description: "MyPackage", version: '0.0.1', 
	   repo: 'RepoName', repoversion: '1.0.0', set: 'main')

d) No you should be able to publish your package into the repository:

gradle nkpublish -PnetKernelKeyStoreUser=<keyid> -PnetKernelKeyStorePassword=<password>

Note: As mentioned above, for now the keystore and keyid should be the same.

This should produce a valid repository structure. You can verify it by saying:

gradle nkrepoverify -PnetKernelKeyStoreUser=<keyid> -PnetKernelKeyStorePassword=<password>

The repo that is generated will be regenerated as needed. You'll probably want to be careful
with it and use version control or something on it.

e) Use rsync or something to connect this repo to a production system (or just use it if you)
are running locally. To generate the repo connection settings to upload to an Apposite

gradle nkrepoconnection -PnetKernelKeyStoreUser=<keyid> -PnetKernelKeyStorePassword=<password>

This will generate the Zip file in build/repos.

f) Tom Geudens (@tomgeudens) introduced a new "daemon" directory to make it easier to add 
modules to a NetKernel installation. To use the Gradle plugin to "publish" into this 
directory, you will need to add this line to the ${netkernelroot}/etc/


The directory can be either relative to the NetKernel installation or absolute anywhere on the

gradle nkdaemon-deploy

will build your project and generate any requested daemon files and copy them into the 
directory specified above.

To specify that a package be included, add the daemonize property to your definePackage call:

nkconfig {
	definePackage(name: 'single-module', description: 'A package with a single module', 
	   version: '0.0.8', repo: 'Foo', repoversion: '1.0.0', set: 'main', daemonize : true)

Any modules associated with the package will be assembled into the daemon file.

Currently, individual modules are not supported but will be soon. There is also not any 
ability to remove the daemon files. This should be done manually at the moment. If you 
change whether a package should be published like this, you should do a

gradle clean nkdaemon-deploy

to clear out the old files. In the future, the plugin will remove any old files that are not
regenerated prior to copying them over.

This is just a quick introduction. There is also support for multiple modules, multiple packages, etc.
But we will add more documentation and examples shortly. This will also become a useful framework
for creating modules and managing many aspects of the NetKernel development process.