Using the Nextflow Gradle plugin
The Nextflow Gradle plugin simplifies plugin development by configuring default dependencies needed for Nextflow integration and defining Gradle tasks for building, testing, and publishing Nextflow plugins.
Note
The Nextflow Gradle plugin and plugin registry are currently available as a private beta. See the migration guide for more information.
Creating a plugin
New in version 25.04.0.
The easiest way to get started with the Nextflow Gradle plugin is to use the nextflow plugin create
sub-command, which creates a plugin project based on the Nextflow plugin template, which in turn uses the Gradle plugin.
To create a Nextflow plugin with the Gradle plugin, run nextflow plugin create
on the command line. It will prompt you for your plugin name, organization name, and project path.
See Nextflow plugin template for more information about the Nextflow plugin template. See Extension points for more information about using plugin extension points.
Building a plugin
To build a plugin, run make assemble
.
Plugins can also be installed locally without being published. To install a plugin locally:
In the plugin root directory, run
make install
.Note
Running
make install
will add your plugin to your$HOME/.nextflow/plugins
directory.Run your pipeline:
nextflow run main.nf -plugins <PLUGIN_NAME>@<VERSION>
Note
Plugins can also be configured via nextflow configuration files. See Using plugins for more information.
Testing a plugin
Unit tests
Unit tests are small, focused tests designed to verify the behavior of individual plugin components.
To run unit tests:
Develop your unit tests. See MyObserverTest.groovy in the plugin template for an example unit test.
In the plugin root directory, run
make test
.
End-to-end tests
End-to-end tests are comprehensive tests that verify the behavior of an entire plugin as it would be used in a Nextflow pipeline. End-to-end tests should be tailored to the needs of your plugin, but generally take the form of a small Nextflow pipeline. See the validation
directory in the plugin template for an example end-to-end test.
Publishing a plugin
The Nextflow Gradle plugin allows you to publish your plugin to the Nextflow plugin registry from the command line.
To publish your plugin:
Create a file named
$HOME/.gradle/gradle.properties
, where$HOME
is your home directory.Add the following properties:
pluginRegistry.accessToken=<REGISTRY_ACCESS_TOKEN>
Replace
<REGISTRY_ACCESS_TOKEN>
with your plugin registry access token.Run
make release
.