@TaskAction
  public void listFiles() throws IOException {
    Preconditions.checkNotNull(jibExtension);
    Project project = getProject();

    // If this is not the root project, add the root project's build.gradle and settings.gradle
    if (project != project.getRootProject()) {
      addGradleFiles(project.getRootProject());
    }

    addProjectFiles(project);

    // Add extra layer
    List<Path> extraDirectories =
        jibExtension.getExtraDirectories().getPaths().stream()
            .map(ExtraDirectoryParameters::getFrom)
            .collect(Collectors.toList());
    extraDirectories.stream().filter(Files::exists).forEach(skaffoldFilesOutput::addInput);

    // Find project dependencies
    Set<ProjectDependency> projectDependencies = findProjectDependencies(project);

    Set<File> projectDependencyJars = new HashSet<>();
    for (ProjectDependency projectDependency : projectDependencies) {
      addProjectFiles(projectDependency.getDependencyProject());

      // Keep track of project dependency jars for filtering out later
      String configurationName = projectDependency.getTargetConfiguration();
      if (configurationName == null) {
        configurationName = "default";
      }
      Project dependencyProject = projectDependency.getDependencyProject();
      for (Configuration targetConfiguration :
          dependencyProject.getConfigurations().getByName(configurationName).getHierarchy()) {
        for (PublishArtifact artifact : targetConfiguration.getArtifacts()) {
          projectDependencyJars.add(artifact.getFile());
        }
      }
    }

    // Add SNAPSHOT, non-project dependency jars
    for (File file :
        project.getConfigurations().getByName(jibExtension.getConfigurationName().get())) {
      if (!projectDependencyJars.contains(file) && file.toString().contains("SNAPSHOT")) {
        skaffoldFilesOutput.addInput(file.toPath());
        projectDependencyJars.add(file); // Add to set to avoid printing the same files twice
      }
    }

    // Configure other files from config
    SkaffoldWatchParameters watch = jibExtension.getSkaffold().getWatch();
    watch.getBuildIncludes().forEach(skaffoldFilesOutput::addBuild);
    watch.getIncludes().forEach(skaffoldFilesOutput::addInput);
    // we don't do any special pre-processing for ignore (input and ignore can overlap with exact
    // matches)
    watch.getExcludes().forEach(skaffoldFilesOutput::addIgnore);

    // Print files
    System.out.println();
    System.out.println("BEGIN JIB JSON");
    System.out.println(skaffoldFilesOutput.getJsonString());
  }
Task Action, print files.

@throws IOException if an error occurs generating the json string
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java