Supposedly the factory fixed the bad 0331 head casting in 03 or 04. I know that there are some difficulties putting a WJ block into an XJ, but I don't know about a TJ.
If it needs a valve job and head gasket and.or you are planning to build a stroker I would try to find a block out of a TJ instead of the WJ one.