private static Set<Object> getArchiveTaskSourcePaths(AbstractArchiveTask archiveTask) {
    try {
      final Method mainSpecGetter = AbstractCopyTask.class.getDeclaredMethod("getMainSpec");
      mainSpecGetter.setAccessible(true);
      Object mainSpec = mainSpecGetter.invoke(archiveTask);
      Method getSourcePaths = mainSpec.getClass().getMethod("getSourcePaths");

      @SuppressWarnings("unchecked")
      Set<Object> sourcePaths = (Set<Object>)getSourcePaths.invoke(mainSpec);
      if (sourcePaths != null) {
        return sourcePaths;
      }
      else {
        return Collections.emptySet();
      }
    }
    catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException ignored) {
      return Collections.emptySet();
    }
  }
private static Set<Object> getArchiveTaskSourcePaths(AbstractArchiveTask archiveTask)