@Nullable
  @Override
  public String getMainClassFromJarPlugin() {
    Jar jarTask = (Jar) project.getTasks().findByName("jar");
    if (jarTask == null) {
      return null;
    }

    Object value = jarTask.getManifest().getAttributes().get("Main-Class");

    if (value instanceof Provider) {
      value = ((Provider<?>) value).getOrNull();
    }

    if (value instanceof String) {
      return (String) value;
    }

    if (value == null) {
      return null;
    }

    return String.valueOf(value);
  }
Generate an instance for a gradle project.

@param project a gradle project
@param logger a gradle logging instance to use for logging during the build
@param tempDirectoryProvider for scratch space during the build
@param configurationName the configuration of which the dependencies should be packed into the
    container
@return a GradleProjectProperties instance to use in a jib build
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java