@SuppressWarnings({"unchecked"})
  private <T> ContainerBuildPlan runPluginExtension(
      Optional<Class<T>> extraConfigType,
      JibMavenPluginExtension<?> extension,
      ExtensionConfiguration config,
      ContainerBuildPlan buildPlan)
      throws JibPluginExtensionException {
    Optional<T> extraConfig = Optional.empty();
    Optional<Object> configs = config.getExtraConfiguration();
    if (configs.isPresent()) {
      if (!extraConfigType.isPresent()) {
        throw new IllegalArgumentException(
            "extension "
                + extension.getClass().getSimpleName()
                + " does not expect extension-specific configuration; remove the inapplicable "
                + "<pluginExtension><configuration> from pom.xml");
      } else if (!extraConfigType.get().isInstance(configs.get())) {
        throw new JibPluginExtensionException(
            extension.getClass(),
            "extension-specific <configuration> for "
                + extension.getClass().getSimpleName()
                + " is not of type "
                + extraConfigType.get().getName()
                + " but "
                + configs.get().getClass().getName()
                + "; specify the correct type with <pluginExtension><configuration "
                + "implementation=\""
                + extraConfigType.get().getName()
                + "\">");
      } else {
        // configs is of type Optional, so this cast always succeeds
        // without the isInstance() check above. (Note generic <T> is erased at runtime.)
        extraConfig = (Optional<T>) configs;
      }
    }

    try {
      return ((JibMavenPluginExtension<T>) extension)
          .extendContainerBuildPlan(
              buildPlan,
              config.getProperties(),
              extraConfig,
              new MavenExtensionData(project, session),
              new PluginExtensionLogger(this::log));
    } catch (RuntimeException ex) {
      throw new JibPluginExtensionException(
          extension.getClass(), "extension crashed: " + ex.getMessage(), ex);
    }
  }
Returns Spring Boot {@code <configuration>} if the Spring Boot plugin is configured to run the
{@code repackage} goal to create a Spring Boot artifact.
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java