private static @NotNull List<File> collectNonSourceSetArtifacts(
    @NotNull Project project,
    @NotNull ModelBuilderContext context
  ) {
    List<File> additionalArtifacts = new ArrayList<>();
    GradleCollectionVisitor.accept(project.getTasks().withType(Jar.class), new GradleCollectionVisitor<Jar>() {

      @Override
      public void visit(Jar element) {
        File archiveFile = GradleTaskUtil.getTaskArchiveFile(element);
        if (archiveFile != null) {
          if (isShadowJar(element) || containsPotentialClasspathElements(element, project)) {
            additionalArtifacts.add(archiveFile);
          }
        }
      }

      @Override
      public void onFailure(Jar element, @NotNull Exception exception) {
        context.getMessageReporter().createMessage()
          .withGroup(Messages.SOURCE_SET_MODEL_NON_SOURCE_SET_ARTIFACT_GROUP)
          .withTitle("Jar task configuration error")
          .withText("Cannot resolve an artifact file for the project Jar task: " + element.getPath())
          .withKind(Message.Kind.WARNING)
          .withException(exception)
          .reportMessage(project);
      }

      @Override
      public void visitAfterAccept(Jar element) {
        context.getMessageReporter().createMessage()
          .withGroup(Messages.SOURCE_SET_MODEL_SKIPPED_NON_SOURCE_SET_ARTIFACT_GROUP)
          .withTitle("Jar task configuration error")
          .withText("Artifact files collecting for project Jar tasks was finished. " +
                    "Resolution for the Jar task " + element.getPath() + " will be skipped.")
          .withInternal().withStackTrace()
          .withKind(Message.Kind.WARNING)
          .reportMessage(project);
      }
    });
    return additionalArtifacts;
  }
private static @NotNull List<File> collectNonSourceSetArtifacts(
    @NotNull Project project,
    @NotNull ModelBuilderContext context
  )