Hello everyone, I’m trying to compile a Nextflow p...
# nextflow-plugins
q
Hello everyone, I’m trying to compile a Nextflow plugin. The compilation works without any errors on my side. However, when I try to use the plugin on a computing cluster, I get the following error:
Copy code
java.lang.UnsupportedClassVersionError: nextflow/executor/slurm_no_memory/SlurmNoMemoryPlugin has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognises class file versions up to 55.0
To fix this, I attempted to compile the plugin using Java 11. The build completes successfully, but I still get the same error on the cluster. I checked the compiled classes with this command:
Copy code
find build/classes/groovy/main/ -name '*.class' -exec javap -verbose {} 2>/dev/null \; | grep 'major'
and the output still shows
major version: 61
instead of 55. I also tried building the plugin inside a Singularity container, but the problem remains. Below is my
build.gradle
. If anyone has suggestions on how to force Gradle/Groovy to compile the plugin with Java 11 bytecode, I would really appreciate your help. Thanks in advance!
Copy code
plugins {
    id 'io.nextflow.nextflow-plugin' version '0.0.1-alpha'
}

compileJava.options.fork = true
compileJava.options.forkOptions.executable = '/usr/bin/javac'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(11)
    }
}

tasks.withType(JavaCompile) {
    options.release = 11
}


version = '0.1.0'

nextflowPlugin {
    nextflowVersion = '24.10.0'

    provider = 'CUBIC-Curie'
    className = 'nextflow.executor.slurm_no_memory.SlurmNoMemoryPlugin'
    extensionPoints = [
        'nextflow.executor.slurm_no_memory.SlurmNoMemoryExecutor',
    ]


}


sourceSets {
    main.java.srcDirs = []
    main.groovy.srcDirs = ['src/main/groovy']
    main.resources.srcDirs = ['src/resources']
    test.groovy.srcDirs = ['src/test/groovy']
    test.java.srcDirs = []
    test.resources.srcDirs = ['src/testResources']
}

configurations {
    // Exclude slf4j-api to avoid conflicts with Nextflow's logging
    runtimeClasspath.exclude group: 'org.slf4j', module: 'slf4j-api'
}

ext {
    nextflowVersion = '24.10.0'
}

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}


dependencies {
    compileOnly "io.nextflow:nextflow:$nextflowVersion"
    compileOnly 'org.slf4j:slf4j-api:2.0.17'
    compileOnly 'org.pf4j:pf4j:3.12.0'
    
    testImplementation "org.apache.groovy:groovy:4.0.26"
    testImplementation "org.apache.groovy:groovy-nio:4.0.26"
    testImplementation "io.nextflow:nextflow:$nextflowVersion"
    testImplementation "org.apache.groovy:groovy-test:4.0.26"
    testImplementation "cglib:cglib-nodep:3.3.0"
    testImplementation "org.objenesis:objenesis:3.1"
    testImplementation "org.spockframework:spock-core:2.3-groovy-4.0"
    testImplementation "org.spockframework:spock-junit4:2.3-groovy-4.0"
    testImplementation "com.google.jimfs:jimfs:1.1"
    
    testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion"))
    testImplementation(testFixtures("io.nextflow:nf-commons:$nextflowVersion"))
}
b
I'm not sure that you'll be able to make it work with Java 11. When we developed the Nextflow Gradle plugin, Nextflow was already requiring Java >=17, so we never tried to make it work with Java 11. It might happen to work, but I wouldn't be surprised if it doesn't I think the easiest way forward would be to target Java 17 and use Java 17 in your cluster
q
Thanks for the clarification. I’ll reach out to the cluster administrators and ask whether they can recompile or upgrade Nextflow to Java 17. That seems like the most straightforward solution.