For a decade, New Jersey and Exxon Mobil Corp. were adversaries in a lawsuit the state filed seeking to make the oil giant pay for environmental damage it did at two sites where it operated refineries. But on Thursday, the state government and the company were working together in court trying to persuade a judge to accept a $225 million settlement that covers damage not only to the refinery sites but to 1,700 other locations around New Jersey, mostly gas stations.