@Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    Preconditions.checkNotNull(projects);
    Preconditions.checkNotNull(session);
    Preconditions.checkNotNull(projectDependenciesResolver);
    checkJibVersion();

    for (MavenProject project : projects) {
      // Add pom configuration files
      skaffoldFilesOutput.addBuild(project.getFile().toPath());
      if ("pom".equals(project.getPackaging())) {
        // done if <packaging>pom</packaging>
        continue;
      }

      // Add sources directory (resolved by maven to be an absolute path)
      skaffoldFilesOutput.addInput(Paths.get(project.getBuild().getSourceDirectory()));

      for (Path directory : getKotlinSourceDirectories(project)) {
        skaffoldFilesOutput.addInput(directory);
      }

      // Add resources directory (resolved by maven to be an absolute path)
      project.getBuild().getResources().stream()
          .map(FileSet::getDirectory)
          .map(Paths::get)
          .forEach(skaffoldFilesOutput::addInput);

      // This seems weird, but we will only print out the jib "extraFiles" directory on projects
      // where the plugin is explicitly configured (even though _skaffold-files-v2 is a
      // jib-maven-plugin goal and is expected to run on all projects irrespective of their
      // configuring of the jib plugin).
      if (project.getPlugin(MavenProjectProperties.PLUGIN_KEY) != null) {
        // Add extra directory
        resolveExtraDirectories(project).forEach(skaffoldFilesOutput::addInput);
      }

      // See above note on "extraFiles"
      SkaffoldConfiguration.Watch watch = collectWatchParameters(project);
      resolveFiles(watch.buildIncludes, project).forEach(skaffoldFilesOutput::addBuild);
      resolveFiles(watch.includes, project).forEach(skaffoldFilesOutput::addInput);
      // we don't do any special pre-processing for ignore (input and ignore can overlap with exact
      // matches)
      resolveFiles(watch.excludes, project).forEach(skaffoldFilesOutput::addIgnore);

      // Grab non-project SNAPSHOT dependencies for this project
      // TODO: this whole sections relies on internal maven API, it could break. We need to explore
      // TODO: better ways to resolve dependencies using the public maven API.
      Set<String> projectArtifacts =
          projects.stream()
              .map(MavenProject::getArtifact)
              .map(Artifact::toString)
              .collect(Collectors.toSet());

      DependencyFilter ignoreProjectDependenciesFilter =
          (node, parents) -> {
            if (node == null || node.getDependency() == null) {
              // if nothing, then ignore
              return false;
            }
            if (projectArtifacts.contains(node.getArtifact().toString())) {
              // ignore project dependency artifacts
              return false;
            }
            // we only want compile/runtime deps
            return Artifact.SCOPE_COMPILE_PLUS_RUNTIME.contains(node.getDependency().getScope());
          };

      try {
        DependencyResolutionResult resolutionResult =
            projectDependenciesResolver.resolve(
                new DefaultDependencyResolutionRequest(project, session.getRepositorySession())
                    .setResolutionFilter(ignoreProjectDependenciesFilter));
        resolutionResult.getDependencies().stream()
            .map(org.eclipse.aether.graph.Dependency::getArtifact)
            .filter(org.eclipse.aether.artifact.Artifact::isSnapshot)
            .map(org.eclipse.aether.artifact.Artifact::getFile)
            .map(File::toPath)
            .forEach(skaffoldFilesOutput::addInput);

      } catch (DependencyResolutionException ex) {
        throw new MojoExecutionException("Failed to resolve dependencies", ex);
      }
    }

    try {
      // Print JSON string
      System.out.println();
      System.out.println("BEGIN JIB JSON");
      System.out.println(skaffoldFilesOutput.getJsonString());
    } catch (IOException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex);
    }
  }
Print out changing source dependencies on a module. In multimodule applications it should be run
by activating a single module and its dependent modules. Dependency collection will ignore
project level snapshots (sub-modules) unless the user has explicitly installed them (by only
requiring dependencyCollection). For use only within skaffold.

<p>Expected use: "./mvnw jib:_skaffold-files-v2 -q" or "./mvnw jib:_skaffold-files-v2 -pl module
-am -q"
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2.java