Since I updated Groovy and other tools, 5.x builds fail with permgen errors in Jenkins. During the build, Groovy (which is large) is loaded three times and this sums up.
See Revision: 1692103
I reverted the Groovy update in 5.x for now. The fix is to make the top-level build.xml also load common-build.xml and resolve groovy before the build starts.