30,369 questions
0
votes
0
answers
51
views
Grails 3.3.10 to 4.0.4 validation problem
I have an old project in grails 3.3.10 and try to migrate to 4.0.4 (step by step, finally to 7)
I have problem with cmds
Caused by: groovy.lang.MissingMethodException: No signature of method: xxx....
0
votes
0
answers
77
views
How to create an atomic unabortable step in jenkins
I have a Jenkins pipeline with a critical stage that runs my custom .NET CLI performing important tasks. I want this stage to be fully atomic, meaning that if someone tries to abort the build while ...
Advice
1
vote
1
replies
21
views
How do Groovy (Jenkins pipeline) singletons work?
Say I have the following classes.
@Singleton
class EnvMgr {
private String environment = "default"
String getEnvironment() {
return environment
}
def setEnvironment(...
0
votes
0
answers
21
views
Jenkins Groovy list user login with Groovy script
I am Rajeswari
In the groovy script i have to filter who login in Jenkins but
I am able to filter the user list all in the manage/security Realm the user list So
How to use it
they is no direct method ...
0
votes
0
answers
45
views
Call GORM's .list() in trait with generic type
In my Grails 6 project, I'd like to add an additional feature to select domain classes, so I defined a custom trait.
trait MyDomainClassTrait<D> implements GormEntity<D> {}
// domain ...
2
votes
1
answer
67
views
How to escape 'properties' in JsonSlurper in Groovy 5?
In Groovy 4.x it was possible to escape the 'properties' keyword when using JsonSlurper using getAt('properties') like below:
import groovy.json.JsonSlurper
def json = new JsonSlurper().parseText(&...
0
votes
0
answers
53
views
TypeChecked extension for JetBrains GDSL files
I'm using JetBrains GDSL files which are a way to define extra methods and properties that are available at runtime to a Groovy script. My use case is for Jenkins pipeline steps but the GDSL ...
0
votes
1
answer
59
views
How to reuse method in loaded script from main script in Jenkins without using libraries
I have a main Groovy file with defined methods, and I've loaded a second Groovy script.
main-script.groovy
node('Node1'){
Method1()
Method2()
def loadedSecondScript = load('./second-...
0
votes
0
answers
88
views
How can I keep track of expired time in a timeout{} step?
Say I have this recursive function in a Jenkins pipeline. It's initially called by another function, but then calls itself recursively.
def recursiveFunction(final Integer timeout) {
static Integer ...
0
votes
1
answer
29
views
How to use Groovy's Map Coercion on a class without a default constructor?
We use Groovy/JUnit to test our Java Spring Boot application. We use Map coercion to define our mocks. I'd like to return a mocked ConfigurableApplicationContext when our main method calls new ...
0
votes
1
answer
68
views
Break & continue nested loops
I have learned that for "break"-ing any loop I use return true and for "continue"-ing it I use return false.Also I learned that "break"-ing each there is no way and for &...
1
vote
1
answer
59
views
unable to find class for annotation @Field in jenkins pipeline script from scm
I'm encountering an issue with my pipeline script when running it from SCM. The @Field annotation isn't being recognized, even though I'm using the correct import statement (import groovy.transform....
0
votes
1
answer
57
views
Why did json views syntax change between Grails 4 and Grails 5?
While upgrading a Grails 4 application to Grails 5, I encountered a failure in one of the json views (.gson file) when specifying a field having an empty map. In Grails 4, this worked fine, but in ...
0
votes
3
answers
41
views
Variable string in groovy's Eval.me()
I would like to use Eval.me to expand a string which contains a variable name.
def var = '1234'
// This works
eval_str = "println $var"
Eval.me(eval_str)
// This does not: No such property:...
1
vote
1
answer
44
views
How to send messages between agents on the same node in Unetstack
I have created two unetstack groovy agents (AnchorMotionAgentV2 and AnchorCommAgentV2), which I expect to send messages to each other. The AnchorCommAgentV2 is expected pass control messages to ...
0
votes
0
answers
38
views
How to replace a value in Groovy Array
characterList:[
{"id":1,"value":"Tom"},
{"id":2,"value":"Jerry"},
{"id":3,"value":"Hulk"},
{"id":4,&...
0
votes
1
answer
43
views
How to reuse a loaded script in another loaded script in Jenkins without using libraries
I have a main job script,
pipline.groovy
node('Node1'){
def script1 = load('script1.groovy')
script1()
//..some code
def script2 = load('script2.groovy')
}
I load two scripts in it,
script1....
1
vote
1
answer
65
views
How to correctly incorporate GroupId in a JAR file using Gradle?
I have 2 projects, a LibraryProject and an ApplicationProject. ApplicationProject needs LibraryProject as a dependency.
In the LibraryProject, the build.gradle contains:
group = 'com.company.product'
...
0
votes
1
answer
57
views
Jmeter does not save variable with variable name <variable-name>_1
I have a loop controller in my test plan with a counter called fileNumber.
I also have a groovy script which fetches keys and uploadIds from the response of an API call. This is the script I have:
...
0
votes
1
answer
44
views
Grails 2.5.6 - "Method on class was used outside of a Grails application" error
I’m using Grails 2.5.6 and I created a simple Person domain and a PersonController.
When I try to call POST /person/add, I get the following error:
Method on class [com.demo.Person] was used outside ...
0
votes
0
answers
32
views
Jenkins Active Choice HTML parameter not updating hidden value field with dynamic JS in Groovy script
Description: I'm using the Jenkins Active Choices Plugin to build a dynamic UI with parameters for test suites and their arguments.
I have two parameters:
SUITES (Active Choice Checkbox): Lets the ...
0
votes
1
answer
109
views
Can't run 'dependencies { earlib ...' on Gradle 9.1.0
Building & deplying my EAR (JAR + WAR) on 'gradle.build' with 'gradle-wrapper.properties' runs fine on 'gradle-8.14.3':
tasks.register('ViViFYdEAR', Ear) {
project.logger.lifecycle(">&...
0
votes
0
answers
58
views
Jenkins Groovy buildRetention is deprecated
I have pipelines that I am building using groovy. Currently I am setting my buildRetention using the following:
strategy {
allBranchesSame {
props {
...
0
votes
0
answers
65
views
Run periodic job only if SVN repository has changes
I'm running Jenkins on a Windows machine, and I have a Jenkinsfile that triggers a pipeline periodically using the cron directive:
pipeline {
agent any
triggers {
cron('0 1 * * 1-5') /...
2
votes
0
answers
100
views
Cannot get Git exit code with Powershell script in Jenkins
In a Jenkins script, I do :
def status = powershell(
script: """
# Display current directory
Write-Host "Current directory: \$(Get-Location)"
# ...
0
votes
0
answers
46
views
Groovy/Grails Ambiguous mapping error with springdoc swagger
This is my controller
package example.infra.adapters.input.api.v1.endpoints
import example.aplication.services.authentication.LoginAuthenticator
import example.aplication.dtos.authentication....
0
votes
0
answers
51
views
How can I get more helpful syntax error messages in a Groovy 4.0.9 Script with embedded methods?
I have embedded Groovy 4.0.9 in my application as a scripting language, and I want to be able to provide helpful feedback to my users when their scripts don't compile. This works ok with a basic ...
0
votes
1
answer
108
views
Grails app + Tomcat + Spring Boot - Memory usage is increasing while the application is idle
I started to test Docker to run my application and I had noticed my memory consume when using "docker stats". I see the memory used from the container increasing like, every f5 on my page or ...
0
votes
1
answer
60
views
findBy when there could be more than one
I'm using a findBy query in a grails/gorm project, where there is usually only one result (and I only ever want one result). However, there could occasionally be two (or even three theoretically, ...
0
votes
1
answer
106
views
Getting user client IP in Jenkins [duplicate]
In Jenkins, I need the IP/Computer Name of the client computer that the user started a Jenkins job from. I have tried this, but it never reaches the inner "if" source: Source 1 Source 2:
...
0
votes
1
answer
61
views
Is there any way to make Groovy 4.0.x compile interfaces with static methods?
I want to make an interface with some static methods for decorating instances or adapting them to other interfaces. However, Groovy 4.0.x gives an error when trying to do this, probably because it's ...
3
votes
2
answers
213
views
Is there a way in *any* JVM language to implement two interfaces with some method(s) with the same signature but different return types
So, I need to have an object implement two interfaces that both require a method with the same signature as each other, but different return types. Something like these two:
interface FooPrinter {
...
0
votes
0
answers
25
views
Why does jenkins declarative pipeline cron trigger allow adding strings, but not joining an array?
Where does the restriction come from, that makes the following invalid?
pipeline {
agent any
triggers {
cron(["TZ=Europe/Berlin", "H H(0-7) * * 0-5"].join("\n&...
0
votes
0
answers
171
views
hudson.remoting.ProxyException: java.nio.file.AccessDeniedException: /var/jenkins_home
Jenkins or the container process tried to write to /var/jenkins_home, but it lacked the required file system permissions.
Jenkins pipelines on Kubernetes using a shared podTemplate that dynamically ...
0
votes
1
answer
48
views
How to create a custom Number type in Groovy behave like a special "NaN-like"
I want to create a custom Number type in Groovy that accepts null, empty strings, and any input valid for the BigDecimal constructor. When given null or an empty string, it should behave like a ...
2
votes
1
answer
225
views
Jenkinsfile groovy-lint Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
I am trying to commit my changes to a Jenkinsfile but I am getting the following info statement:
1 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @...
2
votes
1
answer
81
views
Apache Grails 7.0.0-M4 dependency on Groovy 4.0.27 and why Groovy 4.0.26 is shown in my dependencies tree
I'm moving my team's project from Grails 7.0.0-M1 to 7.0.0-M4 and it kinda works, but I'm new to Grails/Groovy/Gradle/... and curious so I run ./gradlew dependencies | less and notices a block like ...
0
votes
2
answers
92
views
How to define a new scope?
Currently, I am considering these three methods to define a new scope.
if (1) {
def a = 1
}
({
def a = 1
})()
any {
def a = 1
}
Is there anyone better? It seems the official style guide ...
1
vote
1
answer
87
views
How to print (using view) and then exit with multiple workflows in nextflow?
I am debugging a workflow, and cannot quickly find a way to execute view (to print the diagnostic output) and then exit (quit) the workflow. The actual workflow is complex, and I reduced it to a ...
0
votes
1
answer
65
views
Change XML tag based on node value
My XML:
<loadUnit>
<suspect>false</suspect>
<attributeValue>
<name>Lottable02</name>
...
0
votes
1
answer
42
views
XmlSlurper changing empty node to null node
I am fetching a part of xml using XmlSlurper, when xml has <node> </node>(value with 2 space), its converting it as <node/>, but i want to keep it as original XML
Original XML <...
1
vote
1
answer
34
views
Null checks for record constructor arguments in Groovy
We are in the Groovy universe. Let's say I have a record like follows:
record Person(String firstName, String lastName, String city) {}
What is the shortest way to make sure that none of the three ...
1
vote
1
answer
66
views
GroovyScriptEngine fails to load dependent scripts from custom S3-based file system
I'm trying to implement a custom script execution system using GroovyScriptEngine that loads scripts from an S3-like storage system. However, I'm encountering issues with dependency resolution. Here's ...
0
votes
1
answer
199
views
How to print (using view) and then exit in nextflow?
I am debugging a workflow, and cannot quickly find a way to execute view (to print the diagnostic output) and then exit (quit) the workflow.
If I use System.exit(0) or exit(0) in the code snippet ...
1
vote
1
answer
172
views
Mock Java constructors while testing Java-code
I use Spock to test Java-code. For example, I have the following Java-class:
public class Github implements RemoteRepository {
@Override
public Boolean isBranchExist(String branch) {
...
0
votes
1
answer
96
views
Jenkins not creating workspace folder needed for dynamic choice parameter options
this is my first time posting a question so I hope I am doing it right!
I am newer to Jenkins and Groovy, but have been working with the Jenkinsfile for quite a while now, specifically focusing on the ...
0
votes
0
answers
38
views
Force fail build on remote agent disconnected
how can I reliably fail a Jenkins pipeline build if the remote agent disconnects during execution?
binding.setVariable('selectedNode', "")
pipeline {
agent {label: LOCAL_NODE}
...
0
votes
0
answers
29
views
Getting object type for a variable with Groovy in IntelliJ's Structural Replace
I am working on a structural replace tool that creates a variable declarations from some code. My intention is to have inputs like;
inParams.put("userName", user.getUsernameString())
become
...
-3
votes
1
answer
63
views
What is the use-case for `param=value` when calling a Jenkins function?
I was recently stuck on a Jenkins issue due to incorrect assumptions and how Groovy handles named arguments. There's a doc on named arguments here.
We are able to call a function with named arguments ...
0
votes
0
answers
21
views
Cannot refer to type parameter in Groovy class Javadoc comment?
I have the following Javadoc comments and class:
/**
* Base class for immutable {@link Iterator} wrappers that provide a view
* into the wrapped {@link Iterator} with its values transformed.
* ...