Skip to content

Tag: groovy

How to run a Groovy script in my Spring Boot Application?

So I have an existing spring boot app. I want to add a Groovy script (let’s say “HelloWorld.groovy”) to display the message hello world. how can i do this? below is how i want it took like : Answer There are a lot of different ways to do it and there isn’t enough information in the question to know for

Why can’t Nextflow handle this awk phrase?

Background: Using a csv as input, I want to combine the first two columns into a new one (separated by an underscore) and add that new column to the end of a new csv. Input: Desired output: The below awk phrase works from the command line: However, when placed within a nextflow script (below) it gives an error. Here is

Get latest tag in branch with JGit

I am trying to get the JGit equivalent of the command I have tried getting all the tags in the project and then finding the greatest tag in the branch via the BranchListCommand, but that is to slow. I am stuck and I cannot find anything that help via my searches. Does anyone have any idea how to do the

Calling external process from Groovy/Java gives unexpected result

From Groovy/Java I try to execute following command: cmd /c echo mytext. Groovy: 2.4.21, 3.0.9 Java: zulu11.50.19-ca-fx-jdk11.0.12-win_x64 The result is mytext” (including ending double quote). I cannot figure out why the double qoute is there. Can anybody help to explain me why is it there? Thank you. Answer in short: ProcessBuilder will wrap each argument that contains spaces with double

YamlSlurper cannot parse Enum value

I have yaml: Parsing file using YamlSlurper: error: java.lang.ClassCastException: java.lang.String cannot be cast to model.FlowType Is there a way to solve this? Answer The YAML slurper is a cute tool to quickly read a YAML file or string and deal with it to the degree, that you would use the other slurpers: get some basic data types inside lists and

GROOVY I am getting random backslashes when creating JSON file in Folder

I am having trouble compiling the JSON file. This is my method (the main method just has the name of the method I am writing this code in it so I did not include the main method in here.) my output in the console does come out right like this [commands:[{“includeCommandName”:true,”path”:”${BUILTIN_EXE(command)}”,”name”:”upload”},{“includeCommandName”:true,”path”:”${BUILTIN_EXE(command)}”,”name”:”file_info”}]] but sending it to the JSON file it comes

Groovy Shell Sandboxing Best Practices

I am trying to set up a Groovy Shell sandbox that can execute untrusted code. These untrusted codes are provided by the end users (developers) as behaviour configurations, e.g. how to determine if a person is high net worth. So, they really are part of the main program. I need to make sure that I am not vulnerable to any