I want to force following scenario in Jenkins:
I think if you run the System Groovy Script, Jenkins objects are available by default. What you are running is the groovy script. Hence, need to import the packages/classes.