Skip to content

Imports from JARs are no longer supported #6793

@jchorl

Description

@jchorl

Bug report

Hi! In past versions of nextflow, I have been able to throw JARs in lib/ and import them, e.g. with:

#!/usr/bin/env nextflow
nextflow.enable.dsl = 2

import com.me.whatever.Me.MyClass

workflow {
	Channel.of(MyClass.FOO) | view
}

Expected behavior and actual behavior

On latest nextflow (unreleased), I'm getting:

Error testimports.nf:5:1: Groovy `import` declarations are not supported -- use fully-qualified name inline instead
│   5 | import com.me.whatever.Me.MyClass
╰     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

From looking at the code, it looks like parsing logic may have changed around groovy libs. I'm loading java code that is auto-generated so I don't really have the luxury of using "just" groovy files.

I did get this to work with fully qualified paths:

workflow {
	Channel.of(com.me.whatever.Me.MyClass.FOO) | view
}

However in a sophisticated codebase, importing is really helpful. Using fully qualified names everywhere is toilsome, as is the migration!

Any chance you'd consider enabling import from JARs like on 25.10?

Steps to reproduce the problem

Unfortunately I don't have a JAR that I can post, but it should be pretty easy to just compile a standard java class.

Program output

See above

Environment

bash-4.2# ../build/releases/nextflow-25.12.0-edge-dist info
  Version: 25.12.0-edge build 0
  Created: 19-12-2025 11:56 UTC 
  System: Linux 6.8.0-90-generic
  Runtime: Groovy 4.0.30 on OpenJDK 64-Bit Server VM 21.0.10+7-LTS
  Encoding: UTF-8 (UTF-8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions