Category "groovy"

Jenkins pipeline library build using Java instead of Groovy

I would like to write my company Jenkins Pipeline Library using Java not Groovy, as groovy is slower than Java. I tried to find examples of such Java Jenkins li

How do I simply parse a date without a year specified?

I've got a tool which seems to be giving me dates without specifying the year that I need to convert and I'm using Java for the task (actually Groovy but close

how do i add a topic to a running kafka container using docker commands?

I have a kafka container started using following docker run --detach --name kafka -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=192.168.1.89 --env ADVERVTIS

How to retrieve current workspace using Jenkins Pipeline Groovy script?

I am trying to get the current workspace of my Jenkins build using a Groovy pipeline script: node('master') { // PULL IN ENVIRONMENT VARIABLES // Jenki

Jackson version conflict in groovy

When I run the code below using groovy 3.0.2 I get an error because groovy/lib dir already has some older version of jackson and for some reason some of them ge

Get last modification dates of files in directory in git

I have a folder full of files and I want to get the timestamps of last git update for each of those files. I'd like to get those in a Gradle task. I tried the f

Get username logged in Jenkins from Jenkins Workflow (Pipeline) Plugin

I am using the Pipeline plugin in Jenkins by Clouldbees (the name was Workflow plugin before), I am trying to get the user name in the Groovy script but I am no

Jenkinsfile Pipeline DSL: How to Show Multi-Columns in Jobs dashboard GUI - For all Dynamically created stages - When within PIPELINE section

Jenkins 2.89.4 rolling I saw almost all stackoverflow posts which show how we can successfully run parallel steps/stages (using list/maps etc) --OR hardcoding

MapStruct with groovy classes

I want to use the Mapstruct mapper on groovy classes with gradle. The configuration in the build.gradle looks like in a Java project. dependencies { ...

How to pass parameters to SoapUI in command line?

SoapUI could be started from command line with some set of parameters: testrunner.bat -FPDF -R"JUnit-Style HTML Report" -c"my test case" c:\my projects\my-proj

Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node

When i load another groovy file in Jenkinsfile it show me following error. "Required context class hudson.FilePath is missing Perhaps you forgot to surround th

How to repair a business process in hybris using groovy?

I need to repair a business process so i have the OrderProcess but i don't know how to repair it using groovy. Any idea? import de.hybris.platform.core.model.or

Reuse object/property in different stages of a declerative pipeline in Jenkins

We create a new maven build: def rtMaven = Artifactory.newMavenBuild() Now we want to reuse this rtMaven in a different stage than the current one; like in t

ModelService does not remove the model in groovy script

I'm trying to remove a model from database using ModelService in my groovy script but it doesn't remove. import de.hybris.platform.core.model.order.OrderModel i

JAVA/MSSQL: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed

I have got a problem with database queries, when I try to run them from my groovy script. Sometimes, but very often, I've got an error: com.microsoft.sqlserve

How to pass command line argument to Gradle Kotlin DSL

Here's an example from Groovy that represents exactly what I would like to achieve: Command line: ./gradlew jib -PmyArg=hello build.gradle.kts task myTask

Jenkinsfile Declarative Pipeline defining dynamic env vars

I'm new to Jenkins pipeline; I'm defining a declarative syntax pipeline and I don't know if I can solve my problem, because I didn't find a solution. In this e

Jenkins groovy - How to retrieve tag from latest commit?

To fetch the latest commit from branchName, we run below code: treeMapData = git(branch: branchName, credentialsId: credential, url: "${gitLabServer}/${project

Why does the @Override annotation not work when building a Grails project?

I'm using the Grails 2.3.8 build system to build my Grails project (i.e., the default system built on top of Gant). When I annotate my methods with @java.lang.

How to add a JDBC driver to a Jenkins pipeline?

I want to create a database within a pipeline script to be used by the deployed app. But first I started testing the connection. I got this problem: java.sql.S