private ArtifactRepository buildArtifactRepository(Repository repo) throws InvalidRepositoryException {
    MavenRepositorySystem repositorySystem = myRepositorySystem;
    RepositorySystemSession session = getComponent(LegacySupport.class).getRepositorySession();

    ArtifactRepository repository = MavenRepositorySystem.buildArtifactRepository(repo);

    if (session != null) {
      repositorySystem.injectMirror(session, Collections.singletonList(repository));
      repositorySystem.injectProxy(session, Collections.singletonList(repository));
      repositorySystem.injectAuthentication(session, Collections.singletonList(repository));
    }

    return repository;
  }
private ArtifactRepository buildArtifactRepository(Repository repo)