BOSTON — After nine years of regulatory review, the federal government gave the green light on Wednesday to the nation’s first offshore wind farm, a fiercely contested project off the coast of Cape Cod.