private Set<ProjectDependency> findProjectDependencies(Project project) {
    Preconditions.checkNotNull(jibExtension);

    Set<ProjectDependency> projectDependencies = new HashSet<>();
    Deque<Project> projects = new ArrayDeque<>();
    projects.push(project);

    String configurationName = jibExtension.getConfigurationName().get();

    while (!projects.isEmpty()) {
      Project currentProject = projects.pop();

      // Search through all dependencies
      Configuration runtimeClasspath =
          currentProject.getConfigurations().findByName(configurationName);
      if (runtimeClasspath != null) {
        for (Configuration configuration : runtimeClasspath.getHierarchy()) {
          for (Dependency dependency : configuration.getDependencies()) {
            if (dependency instanceof ProjectDependency) {
              // If this is a project dependency, save it
              ProjectDependency projectDependency = (ProjectDependency) dependency;
              if (!projectDependencies.contains(projectDependency)) {
                projects.push(projectDependency.getDependencyProject());
                projectDependencies.add(projectDependency);
              }
            }
          }
        }
      }
    }
    return projectDependencies;
  }
Collects a project's project dependencies, including all transitive project dependencies.

@param project the project to find the project dependencies for
@return the set of project dependencies
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java