
com.google.cloud.tools.jib.maven.extension.JibMavenPluginExtension Maven / Gradle / Ivy
Show all versions of jib-maven-plugin-extension-api Show documentation
/*
* Copyright 2020 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.cloud.tools.jib.maven.extension;
import com.google.cloud.tools.jib.api.buildplan.ContainerBuildPlan;
import com.google.cloud.tools.jib.plugins.extension.ExtensionLogger;
import com.google.cloud.tools.jib.plugins.extension.JibPluginExtension;
import com.google.cloud.tools.jib.plugins.extension.JibPluginExtensionException;
import java.util.Map;
import java.util.Optional;
/**
* Jib Maven plugin extension API.
*
* If a class implementing the interface is visible on the classpath of the Jib Maven plugin and
* the plugin is configured to load the extension class, the Jib plugin extension framework calls
* the interface method of the class.
*/
public interface JibMavenPluginExtension extends JibPluginExtension {
/**
* The type of an custom configuration defined by this extension. The configuration object is
* mapped from {@code }. Often, it is sufficient
* to leverage {@code } and the extension may not
* wish to define a custom configuration; in that case, use {@link Void} for <T> and have
* this method return {@code Optional#empty()}. (Don't return {@code Optional.of(Void.class)}.)
*
* @return type of an extension-specific custom configuration; {@code Optional.empty()} if no need
* to define custom configuration
*/
Optional> getExtraConfigType();
/**
* Extends the build plan prepared by the Jib Maven plugin.
*
* @param buildPlan original build plan prepared by the Jib Maven plugin
* @param properties custom properties configured for the plugin extension
* @param extraConfig extension-specific custom configuration mapped from {@code
* } of type <T>. {@link
* Optional#empty()} when {@link #getExtraConfigType()} returns {@link Optional#empty()} or
* {@code } is not specified by the extension user.
* @param mavenData {@link MavenData} providing Maven-specific data and properties
* @param logger logger for writing log messages
* @return updated build plan
* @throws JibPluginExtensionException if an error occurs while running the plugin extension
*/
ContainerBuildPlan extendContainerBuildPlan(
ContainerBuildPlan buildPlan,
Map properties,
Optional extraConfig,
MavenData mavenData,
ExtensionLogger logger)
throws JibPluginExtensionException;
}