I've never had a problem with cage killing. I build them on platforms suspended by supports. After they've been filled, I pull the corresponding lever, the platform falls, the cage and it's constructed floor smash open and the gobbo's drown. Or get eaten. (1z of water at the bottom of 10z pit, breaks enough that they can't swim. Or 10z's into some harnessed cave critters.)
I'd channel a couple of z under the path ahead of the ballista, and make a winding path for them to have to traverse, giving the operators two or three shots at them. Extra wide batteries of up to 5 ballista increase the chances of hit/kills, and since ballista only fire forward, either side of the path can be lined with additional fortifications, and archer positions. The more fire in the air the better. Two levels up of fortifications will let you put more archers in place.
The last section should have lots of dodge-me's, in a checkerboard pattern for preference, narrowing down to a line of serrated disc grinders (the most agile will make it here, and probably will be wearing less/lighter armor because they were more agile). At the very end, put your military barracks.
Any goblin that makes it through there should be shuttled into drowning boxes. Three or four 4x4 rooms, with small tailing paths that have pressure plates at the entrance. That slams closed bridges locking the gobbos in and also starts pumps, filling the room with water.
Just about the only thing that might make it through would be amphibious mounts, which if not shredded, or with busted bones and ribs, will still be easier to deal with.