@Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        if (skip) {
            return;
        }

        try {
            ProcessBuilder processBuilder = new ProcessBuilder(getCommandPath("psql"), "--version");
            final Process process = processBuilder.start();
            process.waitFor();
            if (process.exitValue() != 0) {
                throw new MojoExecutionException("psql return code " + process.exitValue());
            }

            String result = "";
            try (final InputStreamReader isr = new InputStreamReader(process.getInputStream())) {
                result = IOUtil.toString(isr);
                getLog().info(result);
            }
            if (mandatoryVersionRange != null) {
                final Matcher matcher = Pattern.compile(PATTERN).matcher(result);
                if (matcher.groupCount() != 1) {
                    getLog().warn("Unable to match version number");
                    return;
                }
                final String version = matcher.replaceAll("$1");
                RequirePostgresqlVersion.Builder.matchRange(mandatoryVersionRange)
                        .withVersion(version)
                        .build()
                        .execute(getLog());
            }
        } catch (MojoExecutionException e) {
            throw e;
        } catch (Exception e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }