遇到错误:“启动失败:类生成过程中出现常规错误:方法代码过大!”

huangapple 未分类评论46阅读模式
英文:

Getting error "startup failed: General error during class generation: Method code too large!"

问题

以下是翻译好的部分:

我们目前正在使用脚本流水线,即使在特定阶段构建失败,我也希望能继续执行后续阶段。

我的当前脚本如下:

stage('Push')
{
    withCredentials([usernamePassword(credentialsId: 'gitlogin', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
        sh('git push --tags origin $BRANCH_NAME')
    }
    if ("${BRANCH_NAME}"=="develop" || ("${BRANCH_NAME}".startsWith("release")))
    {    
        sshagent (credentials: ['GitSSHLOGIN']) {
            sh("git tag -a PBCS_${BRANCH_NAME}_${ReleaseNumber}_${BUILD_NUMBER} -m 'Tag the build PBCS_${BRANCH_NAME}_${ReleaseNumber}_${BUILD_NUMBER}'")
            sh('git push --tags origin $BRANCH_NAME')
        }
    }
}

我正在尝试以下行:

catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')

但 Jenkins 报错:

在持久性级别中运行:MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: 启动失败:
类生成过程中的常规错误:方法代码太大!

java.lang.RuntimeException: 方法代码太大!

我请求如果有人能帮我重新构造这段代码以解决问题。

英文:

We are currently using scripted pipeline and I want to continue to further stages even if the build fails in particular stage.

My current script

 stage('Push')
	{
            withCredentials([usernamePassword(credentialsId: 'gitlogin', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
            //sh("git tag -a some_tag -m 'Jenkins'")
                sh('git push --tags origin $BRANCH_NAME')
            }
            if ("${BRANCH_NAME}"=="develop" || ("${BRANCH_NAME}".startsWith("release")))
            {    
                sshagent (credentials: ['GitSSHLOGIN']) {
//                    sh("git tag -d PSTEST ")
                    sh("git tag -a PBCS_${BRANCH_NAME}_${ReleaseNumber}_${BUILD_NUMBER} -m 'Tag the build PBCS_${BRANCH_NAME}_${ReleaseNumber}_${BUILD_NUMBER}'")
                    sh('git push --tags origin $BRANCH_NAME')
                }
            }
	}

I am trying below line

     		catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')

But jenkins is throwing error

Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!

java.lang.RuntimeException: Method code too large!

I request if someone can help me to restructure this code to fix the issue.

huangapple
  • 本文由 发表于 2020年5月4日 19:46:34
  • 转载请务必保留本文链接:https://java.coder-hub.com/61591514.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定