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);
}
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);
}
Aggregations