Archive artifacts stage deprecated in newer jenkins version

Hello Team,

Iam using 2.289.1 jenkins version and the pipeline is failing at archive stage and in our groovy file step is like below:-

stage(‘Archive’) {
def archiveString = componentObject.RetrieveArchiveString()
if(!archiveString) {
archiveString = ‘Components\’ + componentId + ‘\Applicatio\bin\x86\Releas\’ + componentId + ‘.dll, Components\’ + componentId + ‘\html\\*, *.xml, Components\’ + componentId + '\CoveragReport\\, Component\’ + component + '\NDependOut\**\, Component\’ + component + ‘\.sonarqube\**\*’
}
nunit testResultsPattern: ‘TestResult.xml’
step([$class: ‘WarningsPublishe’, canComputeNew: false, canResolveRelativePath: false, defaultEncoding: ‘’, excludePattern: ‘’, healthy: ‘10’, includePattern: ‘’, messagesPattern: ‘’, parserConfiguration: [[parserName: ‘FxCop’, pattern: ‘fxcop-result.xml’]], unHealthy: ‘999’])
archive archiveString
}

Can anyone please suggest me what changes i need to do in “archive” stage?

I checked in google that we need to below command but iam not sure how to add the command to my archive stage step

archiveArtifacts artifacts: 'screenshots/**,build/test/results/*.xml', allowEmptyArchive: true

can anyone reply on this issue please

Hi @vysyaraju
pls check this if it helps Recording tests and artifacts

@vysyaraju
Example stage:

stage('archive') {
            steps {
                script {
                    def archiveString = 'build/libs/**/*.jar'
                    archiveArtifacts artifacts: archiveString, fingerprint: true
                }
            }
        }