private RemoteRepositoryConfiguration getRemoteRepositoryConfiguration(
     RemoteRepository remoteRepository) {
   RemoteRepositoryConfiguration remoteRepositoryConfiguration =
       new RemoteRepositoryConfiguration();
   remoteRepositoryConfiguration.setId(remoteRepository.getId());
   remoteRepositoryConfiguration.setPassword(remoteRepository.getPassword());
   remoteRepositoryConfiguration.setTimeout(remoteRepository.getTimeout());
   remoteRepositoryConfiguration.setUrl(remoteRepository.getUrl());
   remoteRepositoryConfiguration.setUsername(remoteRepository.getUserName());
   remoteRepositoryConfiguration.setLayout(remoteRepository.getLayout());
   remoteRepositoryConfiguration.setName(remoteRepository.getName());
   remoteRepositoryConfiguration.setDownloadRemoteIndex(remoteRepository.isDownloadRemoteIndex());
   remoteRepositoryConfiguration.setRemoteIndexUrl(remoteRepository.getRemoteIndexUrl());
   remoteRepositoryConfiguration.setRefreshCronExpression(remoteRepository.getCronExpression());
   remoteRepositoryConfiguration.setIndexDir(remoteRepository.getIndexDirectory());
   remoteRepositoryConfiguration.setRemoteDownloadNetworkProxyId(
       remoteRepository.getRemoteDownloadNetworkProxyId());
   remoteRepositoryConfiguration.setRemoteDownloadTimeout(
       remoteRepository.getRemoteDownloadTimeout());
   remoteRepositoryConfiguration.setDownloadRemoteIndexOnStartup(
       remoteRepository.isDownloadRemoteIndexOnStartup());
   remoteRepositoryConfiguration.setDescription(remoteRepository.getDescription());
   remoteRepositoryConfiguration.setExtraHeaders(remoteRepository.getExtraHeaders());
   remoteRepositoryConfiguration.setExtraParameters(remoteRepository.getExtraParameters());
   return remoteRepositoryConfiguration;
 }
  protected String calculateIndexRemoteUrl(RemoteRepository remoteRepository) {
    if (StringUtils.startsWith(remoteRepository.getRemoteIndexUrl(), "http")) {
      String baseUrl = remoteRepository.getRemoteIndexUrl();
      return baseUrl.endsWith("/") ? StringUtils.substringBeforeLast(baseUrl, "/") : baseUrl;
    }
    String baseUrl =
        StringUtils.endsWith(remoteRepository.getUrl(), "/")
            ? StringUtils.substringBeforeLast(remoteRepository.getUrl(), "/")
            : remoteRepository.getUrl();

    baseUrl =
        StringUtils.isEmpty(remoteRepository.getRemoteIndexUrl())
            ? baseUrl + "/.index"
            : baseUrl + "/" + remoteRepository.getRemoteIndexUrl();
    return baseUrl;
  }