Example usage for org.apache.maven.plugin MojoExecution getExecutionId

List of usage examples for org.apache.maven.plugin MojoExecution getExecutionId

Introduction

In this page you can find the example usage for org.apache.maven.plugin MojoExecution getExecutionId.

Prototype

public String getExecutionId() 

Source Link

Usage

From source file:co.leantechniques.maven.Project.java

License:Apache License

private PluginExecution addExecution(ExecutionEvent event) {
    MojoExecution mojoExecution = event.getMojoExecution();
    PluginExecution execution = new PluginExecution(plugin(event), mojoExecution.getGoal(),
            mojoExecution.getExecutionId());
    pluginExecutions.add(execution);/*from   ww w.j a  v  a2s  .co  m*/
    indexedExecutions.put(generateKeyFrom(event), execution);
    return execution;
}

From source file:co.leantechniques.maven.Project.java

License:Apache License

private String generateKeyFrom(ExecutionEvent event) {
    MojoExecution mojoExecution = event.getMojoExecution();
    return mojoExecution.getGroupId() + mojoExecution.getArtifactId() + mojoExecution.getGoal()
            + mojoExecution.getExecutionId();
}

From source file:com.ccoe.build.profiler.profile.MojoProfile.java

License:Apache License

public MojoProfile(Context c, MojoExecution mojoExecution, ExecutionEvent event) {
    super(new Timer(), event, c);

    this.mojoExecution = mojoExecution;
    this.pluginGroupID = mojoExecution.getGroupId();
    this.pluginArtifactID = mojoExecution.getArtifactId();
    this.pluginVersion = mojoExecution.getVersion();
    this.pluginExecutionId = mojoExecution.getExecutionId();

    this.event = event;

    // get the configuration of the plugin if the group id matches the KEY.
    // please replace the KEY
    String configuration = "";
    if (mojoExecution.getPlugin().getConfiguration() != null
            && mojoExecution.getPlugin().getGroupId().contains("KEY")) {
        configuration = mojoExecution.getPlugin().getConfiguration().toString();
    }//from  www . j a  va2s  . c  o m
    String payload = " (" + pluginExecutionId + ")  " + configuration;

    if (getSession() != null) {
        plugin.setGroupId(pluginGroupID);
        plugin.setArtifactId(pluginArtifactID);
        plugin.setVersion(pluginVersion);
        plugin.setPluginKey(mojoExecution.getPlugin().getId());
        plugin.setStartTime(new Date(this.getTimer().getStartTime()));
        plugin.setPayload(payload);
        plugin.setExecutionId(pluginExecutionId);
        if (getSession().getCurrentProject().getPhases().size() > 0) {
            getSession().getCurrentProject().getLastPhase().getPlugins().add(plugin);
        }
    }
}

From source file:com.github.sdedwards.m2e_nar.internal.NarTestCompileBuildParticipant.java

License:Apache License

public NarTestCompileBuildParticipant(MojoExecution execution, boolean runOnIncremental,
        boolean runOnConfiguration) {
    super(new MojoExecution(execution.getMojoDescriptor(), execution.getExecutionId(), execution.getSource()),
            runOnIncremental, runOnConfiguration);
    // Some versions of nar-maven-plugin don't have a nar-test-unpack goal
    // this means the test artifacts won't be available to us.
    // What we need to do is run the nar-testCompile goal without any tests
    // its configuration in order to just unpack.
    Xpp3Dom configuration = new Xpp3Dom(execution.getConfiguration());
    logger.debug("Configuration before: " + configuration);
    for (int i = 0; i < configuration.getChildCount(); ++i) {
        if ("tests".equals(configuration.getChild(i).getName())) {
            configuration.removeChild(i);
            break;
        }/*  w w w.  j a  va2  s .c o  m*/
    }
    logger.debug("Configuration after: " + configuration);
    getMojoExecution().setConfiguration(configuration);
}

From source file:com.soebes.maven.extensions.MojoTimer.java

License:Apache License

private MojoKey createMojoKey(MojoExecution mojo) {
    return new MojoKey(mojo.getGroupId(), mojo.getArtifactId(), mojo.getVersion(), mojo.getGoal(),
            mojo.getExecutionId(), mojo.getLifecyclePhase());
}

From source file:com.sumologic.maven.stats.profiler.ProjectProfiler.java

License:Apache License

private MojoProfiler profilerForMojo(ExecutionEvent event) {
    MojoExecution mojo = event.getMojoExecution();
    String key = event.getProject().getName() + " - " + mojo.getGroupId() + ":" + mojo.getArtifactId() + " - "
            + mojo.getGoal() + " - " + mojo.getExecutionId();
    if (mojoProfilerMap.containsKey(key)) {
        return mojoProfilerMap.get(key);
    } else {/*  ww  w .  ja v a  2s .co m*/
        MojoProfiler newProfiler = new MojoProfiler(event.getMojoExecution());
        MojoProfiler oldProfiler = mojoProfilerMap.putIfAbsent(key, newProfiler);
        return (oldProfiler == null) ? newProfiler : oldProfiler;
    }
}

From source file:fr.jcgay.maven.plugin.buildplan.display.AbstractTableDescriptor.java

License:Apache License

protected static Map<TableColumn, Integer> findMaxSize(Collection<MojoExecution> executions,
        TableColumn... columns) {

    Map<TableColumn, Integer> result = new HashMap<TableColumn, Integer>();

    Multimap<TableColumn, Integer> count = ArrayListMultimap.create();
    for (MojoExecution execution : executions) {
        for (TableColumn column : columns) {
            switch (column) {
            case ARTIFACT_ID:
                count.put(column, safeLength(execution.getArtifactId()));
                break;
            case EXECUTION_ID:
                count.put(column, safeLength(execution.getExecutionId()));
                break;
            case GOAL:
                count.put(column, safeLength(execution.getGoal()));
                break;
            case PHASE:
                MojoDescriptor mojoDescriptor = execution.getMojoDescriptor();
                if (mojoDescriptor != null && mojoDescriptor.getPhase() != null) {
                    count.put(column, safeLength(mojoDescriptor.getPhase()));
                } else {
                    count.put(column, safeLength(execution.getLifecyclePhase()));
                }//from  w  ww.  j a v a 2s.c  o m
            }
        }
    }
    for (TableColumn column : TableColumn.values()) {
        count.put(column, column.title().length());
    }

    for (TableColumn key : count.keySet()) {
        result.put(key, Collections.max(count.get(key)));
    }

    return result;
}

From source file:hudson.gridmaven.util.ExecutionEventLogger.java

License:Apache License

private void append(StringBuilder buffer, MojoExecution me) {
    buffer.append(me.getArtifactId()).append(':').append(me.getVersion());
    buffer.append(':').append(me.getGoal());
    if (me.getExecutionId() != null) {
        buffer.append(" (").append(me.getExecutionId()).append(')');
    }// www .j  a va 2  s  . c  o m
}

From source file:io.fabric8.vertx.maven.plugin.mojos.MojoSpy.java

License:Apache License

private void addExecutionIfNotContainedAlready(MojoExecution execution) {
    String artifact = execution.getArtifactId();
    String id = execution.getExecutionId();
    // We must avoid duplicates in the list
    for (MojoExecution exec : MOJOS) {
        if (exec.getArtifactId().equals(artifact) && exec.getExecutionId().equals(id)) {
            // Duplicate found.
            return;
        }/*from w w w  .jav a  2s.c  om*/
    }
    MOJOS.add(execution);
}

From source file:io.reactiverse.vertx.maven.plugin.mojos.AbstractRunMojo.java

License:Apache License

private Callable<Void> toTask(MojoExecution execution) {
    MojoExecutor executor = new MojoExecutor(execution, project, mavenSession, buildPluginManager);

    return () -> {
        try {/*w ww  .  ja  v a  2 s  . c  o  m*/
            //--- vertx-maven-plugin:1.0-SNAPSHOT:run (default-cli) @ vertx-demo
            getLog().info(">>> " + execution.getArtifactId() + ":" + execution.getVersion() + ":"
                    + execution.getGoal() + " (" + execution.getExecutionId() + ") @"
                    + project.getArtifactId());
            executor.execute();
        } catch (Exception e) {
            getLog().error("Error while doing incremental build", e);
        }
        return null;
    };
}