ioc the creation and injection of legacy and local artifacts repo

before merge, pls revise the changes to createLocalArtifactsRepository