All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.wouterdanes.docker.maven.AbstractPreVerifyDockerMojo Maven / Gradle / Ivy

Go to download

A plugin designed to wrap the docker API to prepare docker images for integration testing. Tested containers can then be pushed to a central docker repository and deployed into production.

There is a newer version: 5.0.0
Show newest version
package net.wouterdanes.docker.maven;

import com.google.common.base.Optional;

import net.wouterdanes.docker.remoteapi.exception.DockerException;

/**
 * Base class for Mojos that execute prior to the "verify" phase. In these Mojos,
 * {@link DockerException}s must be caught, suppressed but retained to be rethrown
 * during verification.
 */
public abstract class AbstractPreVerifyDockerMojo extends AbstractDockerMojo {

    @Override
    protected void handleDockerException(String message, DockerException e) {
        getLog().error(message, e);
        Optional apiResponse = e.getApiResponse();
        if (apiResponse.isPresent()) {
            getLog().info(String.format("Api response:%n%s", apiResponse.get()));
        }
        registerPluginError(new DockerPluginError(getMojoGoalName(), message, e));
    }

    /**
     * For diagnostic purposes.
     *
     * @return the goal for this mojo
     */
    protected abstract String getMojoGoalName();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy