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

io.github.mike10004.debianmaven.NonzeroProcessExitAction Maven / Gradle / Ivy

Go to download

This plugin helps building DEB packages from Maven projects. The packages can be used in DEB-based operating systems such as Debian and Ubuntu. The plugin uses external Debian tools to do the actual packaging.

The newest version!
package io.github.mike10004.debianmaven;

import org.apache.maven.plugin.MojoExecutionException;

import java.util.Arrays;
import java.util.Map;

/**
 * Action to perform if a process exit code is nonzero.
 * @see ProcessRunner#runProcess(String[], Map, NonzeroProcessExitAction)
 * @see AbstractDebianMojo#runProcess(String[], Map, NonzeroProcessExitAction)
 */
public interface NonzeroProcessExitAction {

    void perform(int exitval, String[] cmdline) throws MojoExecutionException;

    static NonzeroProcessExitAction doNothing() {
        return (x, c) -> {};
    }

    static NonzeroProcessExitAction throwMojoExecutionException() {
        return  new NonzeroProcessExitAction() {
            @Override
            public void perform(int exitval, String[] cmdline) throws MojoExecutionException {
                throw new MojoExecutionException("Process returned non-zero exit code: " + exitval + " from command " + Arrays.toString(cmdline));
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy