@Override
    public void addRepository(MavenRepository repository) {
        try {
            URI uri = new URI(repository.getUrl());
            int repositoryIndex = remoteRepositories.size() + 1;
            String id = repository.getId().orElseGet(() -> repositoryIndex + "|" + uri.getHost());
            String userInfo = uri.getUserInfo();
            RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", repository.getUrl());
            if (userInfo != null) {
                LOGGER.finest(() -> "Setting username and password for " + id + " using URI authority");
                addUserInfoAuth(uri, userInfo, builder);
            }
            repository.getHttpCredentials().ifPresent(credentials -> addUserInfoAuth(uri, credentials, builder));
            addProxyInfo(repository, builder);
            remoteRepositories.add(builder.build());
        } catch (URISyntaxException e) {
            throw new DependencyResolverException("Invalid Maven repository URL: " + repository.getUrl()
                    + ": " + e.getMessage());
        }
    }
@param cacheLocation Maven local cache location.
smithy-cli/src/main/java/software/amazon/smithy/cli/dependencies/MavenDependencyResolver.java