I'm not sure if the OP is still considering this, but I'll just type a few things that may make him reconsider. If your going from a 2.5 to a 4.0 in your TJ, there are many helpful forums on this swap. I'm in the process of doing this myself. Listed below are a few things to consider:
In your TJ
Motor mounts need to be removed and welded back into place to fit the 4.0
Engine wiring harness is different. Take a look if the harness you pull of your DONOR vehicle is compatible with your buss / guages.
ECM - You'll need to replace the one in your TJ - I don't know if your DONOR vehicle is compatible.
The whole drivetrain needs to be looked at. The 2.5 had 21 splines. The 4.0 has 23. (Are you bringing the transfercase from the DONOR vehicle)
Trans - Depending what trans you have, you may have to bring along it''s own seperate TCM. Since you already have the Harness, it may not be a wiring nightmare, but depending which trans you have (AW-4), a TCM is required.
Driveshafts will more than likely have to be modified to fit your new configuration. I am not familiar if different axles were used - different axles may mean different yokes on the rear end.
Wiring - Will your harness (from DONOR) plug into your existing harness for guages to work.
This is just off the top of my head and I'm sure there are more headaches not for the weak. Like exhaust...
And of course, I'm ALWAYS thinking about what my state (Calif.) will think of to make this swap miserable... Be concious of what inspection hoops you need to jump through.
All this does sound like fun, right?