private static boolean verifyLibraryArtifact(@NotNull CompileContext context,
                                               @NotNull String libraryName,
                                               @NotNull JpsMavenRepositoryLibraryDescriptor descriptor,
                                               @NotNull File artifact) {
    if (!artifact.exists()) return false;

    boolean zipCheckEnabled = SystemProperties.getBooleanProperty(RESOLUTION_RETRY_DOWNLOAD_CORRUPTED_ZIP_PROPERTY, false) ||
                              SystemProperties.getBooleanProperty(RESOLUTION_RETRY_DOWNLOAD_CORRUPTED_ZIP_LEGACY_PROPERTY, false);
    if (zipCheckEnabled && (artifact.getName().endsWith(".jar") || artifact.getName().endsWith(".zip"))) {
        long entriesCount = -1;
        try (ZipFile zip = new ZipFile(artifact)) {
          entriesCount = zip.size();
        }
        catch (IOException ignored) {
        }

        if (entriesCount <= 0) {
          try {
            Path compiledRootPath = artifact.toPath();
            reportCorruptedArtifactZip(context, libraryName, descriptor, compiledRootPath);
            context.processMessage(
              new ProgressMessage(JpsBuildBundle.message("progress.message.removing.invalid.artifact", libraryName, artifact))
            );
            Files.deleteIfExists(compiledRootPath);
            return false;
          }
          catch (IOException e) {
            throw new RuntimeException("Failed to delete invalid zip: " + artifact, e);
          }
        }
      }
    return true;
  }
private static boolean verifyLibraryArtifact(@NotNull CompileContext context,
                                               @NotNull String libraryName,
                                               @NotNull JpsMavenRepositoryLibraryDescriptor descriptor,
                                               @NotNull File artifact)