NASHVILLE, Tenn. — In one busy day at the winter meetings, the Mets wiped away the sting of their failed pursuit of coveted free agent Ben Zobrist by revamping the middle of their infield.

The Mets yesterday swung a trade with the Pirates for second baseman Neil Walker, then followed by signing shortstop Asdrubal Cabrera to a two-year deal. The signing is still pending medical review, but sources confirm it will be worth $18.5 million and includes a team option.

Neither Walker nor Cabrera profile as anything more than adequate defenders. But the Mets have long prioritized offense, particularly power, and both bring above-average power bats to their positions.

ColumnLennon: Yankees kept Mets from getting Zobrist StoryZobrist spurns Mets, signs deal with Cubs

While beefing up the infield, the Mets parted ways with two of their longest-tenured players. Lefthander Jonathon Niese went to the Pirates in exchange for Walker, whose presence takes the Mets out of the market for their incumbent second baseman, free agent Daniel Murphy.

Murphy and Niese were drafted and developed by the Mets, while Walker is a native of Pittsburgh and a homegrown product of the Pirates. In 2016, all three will venture into unknown territory.

“This was a real good baseball trade,” said Mets assistant general manager John Ricco, who a day before insisted that team officials had a plan after missing on Zobrist.

advertisement | advertise on newsday

As the Mets evaluated their alternatives, they had long identified Walker, a 30-year-old switch hitter with a career .272 average. He hit 16 homers last season. Both defensively, and in terms of power, he represented an upgrade over Murphy. On Tuesday night, Mets officials expressed skepticism about their chances of making a deal for Walker. By midday yesterday, the situation changed, with the Pirates seemingly more willing to accept Niese in return.

As Zobrist conducted his introductory news conference, beaming beneath his Cubs cap, the Mets wrapped up the final details of the deal for Walker. “He brings a lot to the club,” manager Terry Collins said. “We’ll certainly see where he fits in the lineup. But, yeah, I could see him hitting second.”

Just as they did at the midsummer trade deadline — when medical concerns nixed a deal for Carlos Gomez and pushed the club toward Yoenis Cespedes instead — the Mets adjusted on the fly to fill a hole in their lineup.

“It’s a little deja vu from midseason,” Ricco said. “We did learn something from that in terms of not letting it get too far down because it’s part of the nature of the game. Things evolve. You’ve just got to keep at it. This turned around rather quickly.”

So, too, did the acquisition of Cabrera. The Mets appeared ready to go with Ruben Tejada and Wilmer Flores at shortstop, where Cabrera provides an upgrade at a key spot. The 30-year-old hit .265 with 15 homers in 143 games with the Rays last season. With Cabrera in the fold, Tejada and Flores likely will be reduced to bench roles, giving Collins valuable depth.

Mets videos

Walker and Murphy have been comparable players. But unlike Murphy, who probably would have required a multi-year deal, Walker is under control for only one more season. It was an important consideration that will allow prospect Dilson Herrera to get more seasoning in the minors.

Walker is projected to make $10 million to $11 million via arbitration, the reason the Pirates put him on the block after expressing little interest in a long-term extension.

“There’s mixed emotions being a born and bred Pittsburgher and obviously not knowing any other organization,” said Walker, who expressed excitement for joining the Mets. “So, it’s definitely been a whirlwind day.”

Niese will make $9 million next season, with a $10-million team option in 2017 and another for $11 million in 2018. The Mets’ pitching depth had made him expendable. Niese, 29, went 9-10 with a 4.13 ERA last season, which he finished working out of the bullpen.

— With David Lennon