public void scmPublishExecute()

in src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java [222:307]


    public void scmPublishExecute() throws MojoExecutionException, MojoFailureException {
        if (siteOutputEncoding == null) {
            getLog().warn("No output encoding, defaulting to UTF-8.");
            siteOutputEncoding = "utf-8";
        }

        if (!content.exists()) {
            throw new MojoExecutionException("Configured content directory does not exist: " + content);
        }

        if (!content.canRead()) {
            throw new MojoExecutionException("Can't read content directory: " + content);
        }

        checkoutExisting();

        final File updateDirectory;
        if (subDirectory == null) {
            updateDirectory = checkoutDirectory;
        } else {
            updateDirectory = new File(checkoutDirectory, subDirectory);

            // Security check for subDirectory with .. inside
            if (!updateDirectory
                    .toPath()
                    .normalize()
                    .startsWith(checkoutDirectory.toPath().normalize())) {
                logError("Try to acces outside of the checkout directory with sub-directory: %s", subDirectory);
                return;
            }

            if (!updateDirectory.exists()) {
                updateDirectory.mkdirs();
            }

            logInfo("Will copy content in sub-directory: %s", subDirectory);
        }

        try {
            logInfo("Updating checkout directory with actual content in %s", content);
            update(
                    updateDirectory,
                    content,
                    (project == null) ? null : project.getModel().getModules());
            String displaySize = org.apache.commons.io.FileUtils.byteCountToDisplaySize(size);
            logInfo(
                    "Content consists of " + MessageUtils.buffer().strong("%d directories and %d files = %s"),
                    directories,
                    files,
                    displaySize);
        } catch (IOException ioe) {
            throw new MojoExecutionException("Could not copy content to SCM checkout", ioe);
        }

        logInfo(
                "Publishing content to SCM will result in "
                        + MessageUtils.buffer().strong("%d addition(s), %d update(s), %d delete(s)"),
                added.size(),
                updated.size(),
                deleted.size());

        if (isDryRun()) {
            int pos = checkoutDirectory.getAbsolutePath().length() + 1;
            for (File addedFile : added) {
                logInfo("- addition %s", addedFile.getAbsolutePath().substring(pos));
            }
            for (File updatedFile : updated) {
                logInfo("- update   %s", updatedFile.getAbsolutePath().substring(pos));
            }
            for (File deletedFile : deleted) {
                logInfo("- delete   %s", deletedFile.getAbsolutePath().substring(pos));
            }
            return;
        }

        if (!added.isEmpty()) {
            addFiles(added);
        }

        if (!deleted.isEmpty()) {
            deleteFiles(deleted);
        }

        logInfo("Checking in SCM, starting at " + new Date() + "...");
        checkinFiles();
    }