private void initiateDownload(@NotNull String url, @NotNull String jarName, @Nullable Project project) {
    ProgressManager.getInstance().run(new Task.Modal(project, JavaBundle.message("progress.title.download.library.descriptor"), true) {
      private String jarUrl;

      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        try {
          String html = HttpRequests.request(url).readString(indicator);
          indicator.checkCanceled();
          Matcher matcher = URLUtil.HREF_PATTERN.matcher(html);
          if (!matcher.find()) {
            return;
          }

          do {
            indicator.checkCanceled();

            String jarUrl = matcher.group(1);
            if (jarUrl != null && jarUrl.endsWith(jarName)) {
              this.jarUrl = jarUrl;
              return;
            }
          }
          while (matcher.find());
        }
        catch (IOException e) {
          LOG.warn(e);
        }
      }

      @Override
      public void onSuccess() {
        if (jarUrl != null) {
          downloadJar(jarUrl, jarName);
        }
      }
    });
  }
private void initiateDownload(@NotNull String url, @NotNull String jarName, @Nullable Project project)