Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grape not supported anymore on Nextflow version v24.0.7.0-edge #5234

Closed
VasLem opened this issue Aug 17, 2024 · 6 comments
Closed

Grape not supported anymore on Nextflow version v24.0.7.0-edge #5234

VasLem opened this issue Aug 17, 2024 · 6 comments

Comments

@VasLem
Copy link

VasLem commented Aug 17, 2024

Bug report

The following piece of code works in v24.06,0-edge but not in the latest version:

@Grab(group='org.apache.commons', module='commons-text', version='1.12.0')
import org.apache.commons.text.similarity.LevenshteinDistance

Program output

ERROR ~ Class definition not found: org/apache/ivy/util/MessageLogger

...
Aug-17 20:03:02.815 [main] ERROR nextflow.cli.Launcher - @unknown
java.lang.NoClassDefFoundError: org/apache/ivy/util/MessageLogger
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:413)
	at java.base/java.lang.Class.forName(Class.java:404)
	at groovy.grape.Grape.getInstance(Grape.java:124)
	at groovy.grape.Grape$1.run(Grape.java:161)
	at groovy.grape.Grape$1.run(Grape.java:158)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at groovy.grape.Grape.grab(Grape.java:158)
	at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:380)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$addPhaseOperationsForGlobalTransforms$5(ASTTransformationVisitor.java:374)
	at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:897)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:373)
	at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:316)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:572)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:585)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:639)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:643)
	at nextflow.script.ScriptParser.parse0(ScriptParser.groovy:175)
	at nextflow.script.ScriptParser.parse(ScriptParser.groovy:206)
	at nextflow.script.ScriptRunner.parseScript(ScriptRunner.groovy:229)
	at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:136)
	at nextflow.cli.CmdRun.run(CmdRun.groovy:372)
	at nextflow.cli.Launcher.run(Launcher.groovy:503)
	at nextflow.cli.Launcher.main(Launcher.groovy:657)
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.util.MessageLogger
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 29 common frames omitted

Environment

  • Nextflow version: v24.0.7.0-edge
  • Java version: java 21.0.1 2023-10-17 LTS
  • Operating system: Ubuntu
  • Bash version: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
@pditommaso
Copy link
Member

pditommaso commented Aug 18, 2024

I think it's a side effect of the new launcher distribution. #3395

However, @Grab was never expected to be supported "officially" by nextflow. It's time to sunsetting it.

@VasLem
Copy link
Author

VasLem commented Aug 18, 2024

I see, thank you for the answer, what is an alternative? I found no documentation about adding Groovy dependencies to a process, and Grape was really that it worked out of the box.

@bentsherman
Copy link
Member

I would try moving this code into a Groovy script in the lib directory. If that doesn't work, I think you can also include a JAR file in the lib directory and it will be added to the classpath.

@bentsherman
Copy link
Member

@VasLem
Copy link
Author

VasLem commented Aug 19, 2024

Hi Ben, thanks for the input. Doesn't Google Batch require Tower in order to have the lib directory considered? If that's not the case, then including the jar file is a good enough alternative I guess.

@bentsherman
Copy link
Member

The lib directory should work regardless of where you run your pipeline.

@pditommaso pditommaso closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants