3.7 isn't a real option, the liberty motor i'm assuming. the jk has the 3.8, but again not worth while. swapping your 4 banger out is gonna cost money and time, and you say it already needs work. you gotta weigh it out, i wouldn't buy a new one though. i love xj's, i use one for my daily driver, and for between 2 and 3 grand you get a really nice jeep.
if you wanna swap engines your best bet is get a donor vehicle, you'll need many parts, computer, wiring, trans, accessories and so on.