Search in sources :

Example 11 with BuildJob

use of org.apache.maven.plugins.invoker.model.BuildJob in project maven-plugins by apache.

the class InvokerSession method updateStats.

private void updateStats() {
    if (successfulJobs != null && skippedJobs != null && failedJobs != null && errorJobs != null) {
        return;
    }
    successfulJobs = new ArrayList<BuildJob>();
    failedJobs = new ArrayList<BuildJob>();
    skippedJobs = new ArrayList<BuildJob>();
    errorJobs = new ArrayList<BuildJob>();
    for (BuildJob buildJob : buildJobs) {
        if (BuildJob.Result.SUCCESS.equals(buildJob.getResult())) {
            successfulJobs.add(buildJob);
        } else if (BuildJob.Result.SKIPPED.equals(buildJob.getResult())) {
            skippedJobs.add(buildJob);
        } else if (BuildJob.Result.ERROR.equals(buildJob.getResult())) {
            errorJobs.add(buildJob);
        } else if (buildJob.getResult() != null) {
            failedJobs.add(buildJob);
        }
    }
}
Also used : BuildJob(org.apache.maven.plugins.invoker.model.BuildJob)

Example 12 with BuildJob

use of org.apache.maven.plugins.invoker.model.BuildJob in project maven-plugins by apache.

the class InvokerSession method logSummary.

/**
     * Prints a summary of this session to the specified logger.
     *
     * @param logger The mojo logger to output messages to, must not be <code>null</code>.
     * @param ignoreFailures A flag whether failures should be ignored or whether a build failure should be signaled.
     */
public void logSummary(Log logger, boolean ignoreFailures) {
    updateStats();
    String separator = buffer().strong("-------------------------------------------------").toString();
    logger.info(separator);
    logger.info("Build Summary:");
    logger.info("  Passed: " + successfulJobs.size() + ", Failed: " + failedJobs.size() + ", Errors: " + errorJobs.size() + ", Skipped: " + skippedJobs.size());
    logger.info(separator);
    if (!failedJobs.isEmpty()) {
        String heading = "The following builds failed:";
        if (ignoreFailures) {
            logger.warn(heading);
        } else {
            logger.error(heading);
        }
        for (BuildJob buildJob : failedJobs) {
            String item = "*  " + buildJob.getProject();
            if (ignoreFailures) {
                logger.warn(item);
            } else {
                logger.error(item);
            }
        }
        logger.info(separator);
    }
}
Also used : BuildJob(org.apache.maven.plugins.invoker.model.BuildJob)

Example 13 with BuildJob

use of org.apache.maven.plugins.invoker.model.BuildJob in project maven-plugins by apache.

the class InvokerMojoTest method testSingleInvokerTest.

public void testSingleInvokerTest() throws Exception {
    InvokerMojo invokerMojo = new InvokerMojo();
    String dirPath = getBasedir() + "/src/test/resources/unit";
    List<String> goals = invokerMojo.getGoals(new File(dirPath));
    assertEquals(1, goals.size());
    setVariableValueToObject(invokerMojo, "projectsDirectory", new File(dirPath));
    setVariableValueToObject(invokerMojo, "invokerTest", "*dummy*");
    BuildJob[] poms = invokerMojo.getBuildJobs();
    assertEquals(1, poms.length);
}
Also used : BuildJob(org.apache.maven.plugins.invoker.model.BuildJob) File(java.io.File)

Aggregations

BuildJob (org.apache.maven.plugins.invoker.model.BuildJob)13 File (java.io.File)9 IOException (java.io.IOException)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 Sink (org.apache.maven.doxia.sink.Sink)2 BufferedWriter (java.io.BufferedWriter)1 FileWriter (java.io.FileWriter)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 DecimalFormat (java.text.DecimalFormat)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 LinkedHashSet (java.util.LinkedHashSet)1 ExecutorService (java.util.concurrent.ExecutorService)1 BuildJobXpp3Reader (org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader)1 BuildJobXpp3Writer (org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Writer)1 MavenReportException (org.apache.maven.reporting.MavenReportException)1 SettingsXpp3Writer (org.apache.maven.settings.io.xpp3.SettingsXpp3Writer)1 DirectoryScanner (org.codehaus.plexus.util.DirectoryScanner)1