nf-plugin-template is a gradle template to create Nextflow plugins

You can grab the template from:

Features

  • minimal changes

  • simple structure, oriented to a single plugin

  • gradle 8.4

  • custom Gradle tasks included

  • ready to publish GitHub releases

  • asciidoctor documentation + GitHub Pages

Steps

INFO

From version 0.3.0 you don’t need to specify the pluginClassName in the nextflow closure configuration as the gradle tasks will scan for it

  • Create a new Github project using this template

  • Clone in a directory with the name of your new plugin, i.e. nf-my-awesome-plugin

  • Specify your github account in nf-plugin.gradle file

nf-plugin.gradle
nextflowPlugin{
    githubOrganization = 'YOUR_GITHUB_ACCOUNT'
}

githubOrganization is used in case you want to publish in GitHub your plugin.

  • add your dependencies

nf-plugin.gradle
dependencies {
    // add your dependencies, for example:
    implementation 'org.apache.poi:poi:5.2.4'
    implementation 'org.apache.poi:poi-ooxml:5.2.4'
}
  • rename src/main/groovy/com/nextflow/plugin directory and ExamplePlugin.groovy file with the package and name of your plugin

  • rename ExamplePlugin with a better name (for example MyAwesomePlugin)

  • delete/rename/update the ExampleFunctions.groovy with your extension

You don’t need to create the extensions points file (src/main/resources/META-INF/extensions.idx) as registerIdx task will scan your sources and build it

and this is all, you can run ./gradlew jsonPlugin to generate Nextflow’s artifacts

Tasks

You can find new gradle tasks in nextflow group

  • generateIdx, scan sources and generate the extensions.idx resource

  • zipPlugin , compile and package your plugin in a zip file ready to be used by Nextflow

  • unzipPlugin , extract the zip file into your $HOME/.nextflow/plugins so you can use it in pipelines

  • jsonPlugin, create the json spec required by nextflow to publish a plugin

Documentation

This template include asciidoctor gradle plugin to generate documentation.

You can write your documentation at src/docs/asciidoc and run ./gradlew asciidoctor to build it at build/doc directory.

Remember to prepare your GitHub repository with GH Pages (go to Settings, Pages and select GitHub Actions as source) and your documentation will be published automagically