private static void resolveMissingDependency(CompileContext context, BuildTargetChunk currentTargets,
                                               JpsTypedLibrary<JpsSimpleElement<JpsMavenRepositoryLibraryDescriptor>> lib,
                                               boolean verifySha256Checksums,
                                               boolean useBindRepositories) throws Exception {
    final JpsMavenRepositoryLibraryDescriptor descriptor = lib.getProperties().getData();
    List<File> compiledRoots = lib.getFiles(JpsOrderRootType.COMPILED);
    JpsLibraryResolveGuard.performUnderGuard(context, descriptor, compiledRoots, () -> {
      try {
        // list of missing roots needed to be resolved
        List<File> required = ContainerUtil.filter(compiledRoots, root -> !verifyLibraryArtifact(context, lib.getName(), descriptor, root));

        // be strict and verify effective repo manager exists (will throw an exception if bind repository is required, but missing)
        ArtifactRepositoryManager effectiveRepoManager = getRepositoryManager(context, descriptor, lib.getName(), useBindRepositories);

        if (!required.isEmpty()) {
          context.processMessage(new ProgressMessage(JpsBuildBundle.message("progress.message.resolving.0.library", lib.getName()), currentTargets));
          LOG.debug("Downloading missing files for " + lib.getName() + " library: " + required);

          final Collection<File> resolved = effectiveRepoManager.resolveDependency(descriptor.getGroupId(), descriptor.getArtifactId(),
                                                                                   descriptor.getVersion(),
                                                                                   descriptor.isIncludeTransitiveDependencies(), descriptor.getExcludedDependencies());
          if (!resolved.isEmpty()) {
            syncPaths(required, resolved);
          }
          else {
            LOG.info("No artifacts were resolved for repository dependency " + descriptor.getMavenId());
          }

          if (LOG.isDebugEnabled()) {
            Set<String> missing = required.stream().map(it -> FileUtil.toCanonicalPath(it.getAbsolutePath())).collect(Collectors.toSet());
            resolved.forEach(it -> missing.remove(FileUtil.toCanonicalPath(it.getAbsolutePath())));
            if (!missing.isEmpty()) {
              LOG.debug("Files are not downloaded completely for library '" + lib.getName() + "'," +
                        " descriptor '" + descriptor.getMavenId() + "'." +
                        " Required " + required + " but resolved " + resolved +
                        ". Missing " + missing);
            }
          }
        }
        verifyLibraryRootsChecksums(context, lib.getName(), descriptor, compiledRoots, verifySha256Checksums);
      }
      catch (TransferCancelledException e) {
        context.checkCanceled();
      }
    });
  }
private static void resolveMissingDependency(CompileContext context, BuildTargetChunk currentTargets,
                                               JpsTypedLibrary<JpsSimpleElement<JpsMavenRepositoryLibraryDescriptor>> lib,
                                               boolean verifySha256Checksums,
                                               boolean useBindRepositories)