Skip to content

nextflow-io/nextflow-plugin-gradle

Repository files navigation

Gradle plugin for Nextflow

Warning

This plugin is in early active development, please use nextflow-io/nf-hello for production usage for now.

This is a Gradle plugin for building Nextflow plugins.

It sets up default dependencies required for integration with Nextflow, and adds some custom gradle tasks to help build and publish your Nextflow plugin.

Configuration

Apply and configure this plugin in your build.gradle file, for example:

plugins {
    id 'io.nextflow.nextflow-plugin' version '1.0.0-beta.5'
}

dependencies {
    // (optional) put any library dependencies here
}

// plugin version
version = '0.0.1'

nextflowPlugin {
    // minimum nextflow version
    nextflowVersion = '25.04.0'

    provider = 'Example Inc'
    description = 'My example plugin'
    className = 'com.example.ExamplePlugin'
    extensionPoints = [
        'com.example.ExampleObserver',
        'com.example.ExampleFunctions'
    ]
}

Configuration Options

The nextflowPlugin block supports the following configuration options:

  • nextflowVersion (required) - Specifies the minimum Nextflow version required by the plugin
  • className (required) - The fully qualified name of the main plugin class
  • provider (required) - The plugin provider/author name
  • description (optional) - A short description of the plugin
  • requirePlugins (optional) - List of plugin dependencies that must be present
  • extensionPoints (optional) - List of extension point class names provided by the plugin

Registry Configuration

The registry block is optional and supports several configuration methods:

Option 1: Explicit configuration

registry {
    url = 'https://registry.nextflow.io/api'
    apiKey = 'your-api-key'
}

Option 2: Using project properties Define npr.apiUrl and npr.apiKey in your local gradle.properties OR $HOME/.gradle/gradle.properties:

npr.apiUrl=https://registry.nextflow.io/api
npr.apiKey=your-api-key

Option 3: Using environment variables Export environment variables in your shell:

export NPR_API_URL=https://registry.nextflow.io/api
export NPR_API_KEY=your-api-key

The configuration precedence is: explicit values → project properties → environment variables → defaults.

Available Tasks

This will add some useful tasks to your Gradle build:

  • assemble - Compile the Nextflow plugin code and assemble it into a zip file
  • installPlugin - Copy the assembled plugin into your local Nextflow plugins dir
  • releasePlugin - Release the assembled plugin to the plugin registry (always available)
  • releasePluginToRegistry - Release the plugin to the configured registry (always available)

You should also ensure that your project's settings.gradle declares the plugin name, eg:

rootProject.name = '<YOUR-PLUGIN-NAME>'

Migrating an existing Nextflow plugin

Follow these steps to migrate an existing Nextflow plugin:

  1. If your project uses a plugins dir, move its src dir to the project root
  2. Make sure your plugin sources are now in src/main/groovy or src/main/java
  3. Replace any gradle build files with the configuration described above

See nextflow-io/nf-hello#21 for an example

To build and test the plugin locally

This section is only relevant if you want to make changes to this Gradle plugin itself, and isn't needed for developing Nextflow plugins.

  1. Checkout this project and install it to your local maven repo: ./gradlew publishToMavenLocal
  2. In your Nextflow plugin project, add this to the settings.gradle:
pluginManagement {
    repositories {
      mavenLocal()
      gradlePluginPortal()
    }
}
  1. Apply the configuration, as described above

Development of Gradle plugin for Nextflow

To release this plugin include the Gradle plugins registry API keys in your gradle.properties.

Then use this command:

./gradlew publishPlugins

About

Gradle plugin for making Nextflow plugins

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •