Search in sources :

Example 1 with StandardWarExplodedProcessor

use of com.google.cloud.tools.jib.cli.war.StandardWarExplodedProcessor in project jib by google.

the class ArtifactProcessors method fromWar.

/**
 * Creates a {@link ArtifactProcessor} instance.
 *
 * @param warPath path to the war
 * @param cacheDirectories the location of the relevant caches
 * @param warOptions war cli options
 * @param commonContainerConfigCliOptions common cli options shared between jar and war command
 * @return ArtifactProcessor
 * @throws InvalidImageReferenceException if base image reference is invalid
 */
public static ArtifactProcessor fromWar(Path warPath, CacheDirectories cacheDirectories, War warOptions, CommonContainerConfigCliOptions commonContainerConfigCliOptions) throws InvalidImageReferenceException {
    Optional<AbsoluteUnixPath> appRoot = warOptions.getAppRoot();
    if (!commonContainerConfigCliOptions.isJettyBaseimage() && !appRoot.isPresent()) {
        throw new IllegalArgumentException("Please set the app root of the container with `--app-root` when specifying a base image that is not jetty.");
    }
    AbsoluteUnixPath chosenAppRoot = appRoot.orElse(AbsoluteUnixPath.get(DEFAULT_JETTY_APP_ROOT));
    return new StandardWarExplodedProcessor(warPath, cacheDirectories.getExplodedArtifactDirectory(), chosenAppRoot);
}
Also used : AbsoluteUnixPath(com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath) StandardWarExplodedProcessor(com.google.cloud.tools.jib.cli.war.StandardWarExplodedProcessor)

Example 2 with StandardWarExplodedProcessor

use of com.google.cloud.tools.jib.cli.war.StandardWarExplodedProcessor in project jib by GoogleContainerTools.

the class ArtifactProcessors method fromWar.

/**
 * Creates a {@link ArtifactProcessor} instance.
 *
 * @param warPath path to the war
 * @param cacheDirectories the location of the relevant caches
 * @param warOptions war cli options
 * @param commonContainerConfigCliOptions common cli options shared between jar and war command
 * @return ArtifactProcessor
 * @throws InvalidImageReferenceException if base image reference is invalid
 */
public static ArtifactProcessor fromWar(Path warPath, CacheDirectories cacheDirectories, War warOptions, CommonContainerConfigCliOptions commonContainerConfigCliOptions) throws InvalidImageReferenceException {
    Optional<AbsoluteUnixPath> appRoot = warOptions.getAppRoot();
    if (!commonContainerConfigCliOptions.isJettyBaseimage() && !appRoot.isPresent()) {
        throw new IllegalArgumentException("Please set the app root of the container with `--app-root` when specifying a base image that is not jetty.");
    }
    AbsoluteUnixPath chosenAppRoot = appRoot.orElse(AbsoluteUnixPath.get(DEFAULT_JETTY_APP_ROOT));
    return new StandardWarExplodedProcessor(warPath, cacheDirectories.getExplodedArtifactDirectory(), chosenAppRoot);
}
Also used : AbsoluteUnixPath(com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath) StandardWarExplodedProcessor(com.google.cloud.tools.jib.cli.war.StandardWarExplodedProcessor)

Aggregations

AbsoluteUnixPath (com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath)2 StandardWarExplodedProcessor (com.google.cloud.tools.jib.cli.war.StandardWarExplodedProcessor)2