Checkout not working in pipeline Jenkins

Checkout is not working when i am using shared library, checkout is working when i am removing all things related to shared library from jenkins file,
The error i am facing:

I am using a shared library. the shared library looks like:

def build(String COMPONENTS, String Dmaven_test_skip){
	script{
		markBuild pipelineType: 'CI'
		sh "java -version"
		if(Dmaven_test_skip=="true"){
			withEnv(["JAVA_HOME=${tool 'jdk-8'}"]){
				sh "cd "+${COMPONENTS}+";mvn clean install" 
			}
		}
		else{
			withEnv(["JAVA_HOME=${tool 'jdk-8'}"]){
				sh "cd "+${COMPONENTS}+";mvn clean install -Dmaven.test.skip=false -Dmaven.test.failure.ignore=true" 
			}
		}
		echo "+++ BUILD OVER +++"

		markBuild pipelineType: 'PT,CD',  environment: 'QA2'
	
	}
}

My jenkinsFile looks like:

@Library("test-library") _
pipeline
{
	agent any
	stages 
	{
	                         stage('Version Mgmt, Head Checkout')
                                {
                                    when { 
                                        anyOf{
                                        environment name: 'COMPONENTS', value: 'A' 
                                        environment name: 'COMPONENTS', value: 'B' 
                                        }
                                        }
                                    steps
			                            {
			                            script{
			                                echo "below throwing error"
			                                if(COMPONENTS=="A"){
			                                    checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'svnfinal', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'svn link here']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']]).any()
				                                checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'svnfinal', depthOption: 'infinity', ignoreExternalsOption: true, local: './metadata', remote: 'svn link here']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']]).any()
			                                    functions.build("${COMPONENTS}","${Dmaven_test_skip}")
												}
			                                 if(COMPONENTS=="B"){
			                                    checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'svnfinal', depthOption: 'infinity', ignoreExternalsOption: true, local: './BPMN-ProcessOrchestrator', remote: 'svn link here']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
												functions.build("${COMPONENTS}","${Dmaven_test_skip}")
											 }
			                                 }
			                            }
                                }
	}
}