CJ-7 will lose almost any battle when rust is brought up. Tubs don't last and the frames will always be rusted inside the rear frame rails. YJ tubs are galvanized, and very close to the same dimensions as the CJ-7 and darn close bolt-on a CJ-7. Not sure about the newer Wranglers (TJ and JK) being galvanized, I can't imagine they would be worse than a CJ-7.
The AMC20 in the rear of most CJ-7s can be built up to a Dana44 strength, it just needs one-piece axles and the tubes trussed. CJ-7 beats any YJ in this category, they all had D35s. The final year of CJ-7 production, they ran out of AMC20 and used some Dana 44s.
Both YJ and CJ-7 had the Dana30 front with the little U-joint, except 95 YJ had the 297/760 joints. All YJ D30s are vacuum disconnect and dont have lockout hubs.
early CJ-7s have the Dana 20 t-case (2:1 low range), later ones have the Dana 300 (2.87ish low). Both are good steel cases, I'm sure someone will point out their weaknesses. YJ started with an aluminum china driven NP207 I think, then went to the NP231, which carried into the TJ. CJ-7 is pass.side drop front axle, YJ/TJ are pass.side, not much swapability. As Chip mentioned, CJ-7 also got the quadratrac behind the automatic trannies.
For the transmission, CJ-7's started out good offering the optional 4spd granny low T18. Most of them ended up with the 3-spd T150 with terribly high first gear. When they swapped to the D300, the whole tranny lineup changed to a serious of light and medium duties. The 4spd T176 was probaly the best of the bunch. All the 5-spd trannies are worthless. As far as auto, I want to say it was a TF999, but not sure.
The YJ continued the downward trend in shitty manual transmission with the Peugot BA-10 or whatever it was designated. They finally started using AX5 (4cyl) and AX15 (6cyl). No idea what auto tranny was used.
The CJ-7 is the only choice if you want a factory V8, the 304 was used, but the 360 is a common swap, the 401 also has the same dimensions and will drop in too. They also used 232 and 258 inline 6 with a one barrel carb, later switching to a troublesome 2bbl carb. For 4 bangers, you could get an AMC engine or the GM Iron Duke, bonus 4.10 axle gears with these. most other engines gave the 3.55 gears, but in the 80s, there was a lot of 2.73 used.
I think all YJ 4 bangers were the new 2.5L MPI. They continued to use the crappy emmission controlled Carter BBD carb on the 258 (4.2L) I6, until 1991 4.0L MPI was introduced. Basically its a destroked 258 with larger bore pistons, a better flowing head, and of course fuel injection.