My one fort, Marblehalls, has some strange self-imposed rules, one of which is "Absolutely no military whatsoever untill we're a Mountainhome."
So we use cage traps. A lot of cage traps.
My Units screen has over 19 pages of caged goblins & trolls, as well as a Cyclops, a Dragon, and the war leader of the local goblin civilization.
So I know what I'm talkin' about.
Behold, the Siege Sorter:
║
╚════════════════════════════════════
┼^^^^^^^^┼^^^^^^^^┼^^^^^^^^┼^^^^^^^^┼
O════════════════════════════════════
outside ^^^^^^^^^┼^^^^^^^^,^^^^^^^^,^^^^^^^^┼ inside
the O════════════════════════════════════ the
fort ^^^^^^^^^┼^^^^^^^^,^^^^^^^^,^^^^^^^^┼ fort
O════════════════════════════════════
┼^^^^^^^^┼^^^^^^^^┼^^^^^^^^┼^^^^^^^^┼
╔════════════════════════════════════
║
The design can be repeated, of course, but works best as a long, straight line. All of the doors are locked against animals (you probably don't want to be wasting your precious cages on turkeys & foxes), but otherwise allow free passage. When a siege arrives, designate [q] all of the doors in the outer hallways to forbid all traffic (but leave the inner doors alone), and building-examine [t] every single cage trap and [f]orbid both the cages, and the mechanisms themselves. (Forbidding these pre-emptively cancels both the "Store Item in Stockpile" and the "Load Cage Trap" jobs that get created when a cage trap triggers--thus preventing your civilians from walking right into a battle zone.) Then sit back & watch.
Goblins will ignore the 2 outer hallways and path to the center ones. If they start to get too close to the end, just slam that last door in their collective face and they'll be forced to try another hallway. Goblins that hang around a captured squad leader can be prompted back into activity by showing them a dwarf: Designate one of the empty tiles [,] to be Channeled, thus bringing a Miner into the goblin's sight range. The Miner will either flee back inside, or (goddamn you stupid dorf) decide to attack the goblin. If he chooses the former, you may need a couple of tries before the dwarf successfully lures the goblin further down the hallway--and into the waiting cage traps therein. If he chooses the latter, hopefully the Miner's innate badassery will save his life, and even if it doesn't, the goblin will resume his (ultimately futile) task of trying to path into your fort.
Trolls will attack the closest viable target they can reach, i.e. the doors in the outer corridors. After they break the outer door down, the next closest victim will be . . . the next door down the same hallway. Trolls arrive in groups of 8, so 8 traps in a row neatly avoids the issue of 1 Troll taking forever to topple a door because he's working all alone. Once the trolls are taken care of, unlock the doors and invite any unattached goblins in.
After the "battle," just un-forbid your cages and the trap mechanisms (can also be used sparingly during the siege to nudge "stuck" goblins with a random hauler, if you don't want to risk losing a Miner).
Q: But what about Trapimmune Building Destroyers?
A: You know it's going to be spending a good deal of time trapped in a very narrow hallway, and you even know the exact tile(s) where it's going to stand as it breaks down a door. Surely a 1-tile cave-in is within your capabilities.