As Clay mentioned that best thing to do is get a donor vehicle. I did this swap about 1.5 years ago now. I swapped in a 94 XJ drivetrain into my 95 YJ. I took the engine, tranny, and t-case (you will need a new t-case you you will have to change the input gears), and put in my new YJ. Here is what you will need
-New motor mounts
-Lengthened front DS
-Shortened rear DS
-New fan shroud, unless going electric
As for the wiring, the firewall connectors are different between the XJs and YJs, so the guy doing my install found it easier to wire in the 2 extra cylinders than to change the bulkhead connector over on the XJ harness. This was for the underhood harness. Another thing to watch out for is that the XJ t-cases are clocked lower than the YJ cases. It has not caused me any problems but they did have to cut my t-case skid a little to allow for clearance
That about covers it