private void debugMojoExecution( MojoExecution mojoExecution ) { String mojoExecId = mojoExecution.getGroupId() + ':' + mojoExecution.getArtifactId() + ':' + mojoExecution.getVersion() + ':' + mojoExecution.getGoal() + " (" + mojoExecution.getExecutionId() + ')'; Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions(); if ( !forkedExecutions.isEmpty() ) { for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() ) { logger.debug( "--- init fork of " + fork.getKey() + " for " + mojoExecId + " ---" ); debugDependencyRequirements( fork.getValue() ); for ( MojoExecution forkedExecution : fork.getValue() ) { debugMojoExecution( forkedExecution ); } logger.debug( "--- exit fork of " + fork.getKey() + " for " + mojoExecId + " ---" ); } } logger.debug( "-----------------------------------------------------------------------" ); logger.debug( "Goal: " + mojoExecId ); logger.debug( "Style: " + ( mojoExecution.getMojoDescriptor().isAggregator() ? "Aggregating" : "Regular" ) ); logger.debug( "Configuration: " + mojoExecution.getConfiguration() ); }
private static String createMessage( MojoExecution execution, MavenProject project, Throwable cause ) { MessageBuilder buffer = buffer( 256 ); buffer.a( "Failed to execute goal" ); if ( execution != null ) { buffer.a( ' ' ); buffer.mojo( execution.getGroupId() + ':' + execution.getArtifactId() + ':' + execution.getVersion() + ':' + execution.getGoal() ); buffer.a( ' ' ).strong( '(' + execution.getExecutionId() + ')' ); } if ( project != null ) { buffer.a( " on project " ); buffer.project( project.getArtifactId() ); } if ( cause != null ) { buffer.a( ": " ).failure( cause.getMessage() ); } return buffer.toString(); }
@Override public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig ) { String g = mojoExecution.getGroupId(); String a = mojoExecution.getArtifactId(); Plugin plugin = findPlugin( g, a, project.getBuildPlugins() ); if ( plugin == null && project.getPluginManagement() != null ) { plugin = findPlugin( g, a, project.getPluginManagement().getPlugins() ); } if ( plugin != null ) { PluginExecution pluginExecution = findPluginExecution( mojoExecution.getExecutionId(), plugin.getExecutions() ); Xpp3Dom pomConfiguration = null; if ( pluginExecution != null ) { pomConfiguration = (Xpp3Dom) pluginExecution.getConfiguration(); } else if ( allowPluginLevelConfig ) { pomConfiguration = (Xpp3Dom) plugin.getConfiguration(); } Xpp3Dom mojoConfiguration = ( pomConfiguration != null ) ? new Xpp3Dom( pomConfiguration ) : null; mojoConfiguration = Xpp3Dom.mergeXpp3Dom( mojoExecution.getConfiguration(), mojoConfiguration ); mojoExecution.setConfiguration( mojoConfiguration ); } }
public static boolean mojoExecutionForPlugin( final MojoExecution mojoExecution, final String groupId, final String artifactId, final String goal) { return groupId.equals(mojoExecution.getGroupId()) && artifactId.equals(mojoExecution.getArtifactId()) && (goal == null || goal.equals(mojoExecution.getGoal())); }
protected MojoExecution findForkedExecution(final MojoExecution primary, final String groupId, final String artifactId, final String goal) { final Map<String, List<MojoExecution>> forkedExecutions = primary.getForkedExecutions(); MojoExecution goalExecution = null; for (final List<MojoExecution> possibleExecutionList : forkedExecutions .values()) { for (final MojoExecution possibleExecution : possibleExecutionList) { if (groupId.equals(possibleExecution.getGroupId()) && artifactId.equals(possibleExecution.getArtifactId()) && goal.equals(possibleExecution.getGoal())) { goalExecution = possibleExecution; break; } } if (goalExecution != null) { break; } } return goalExecution; }
private String mojoExec(ExecutionEvent event) { MojoExecution me = event.getMojoExecution(); return String.format("%s:%s:%s(%s)", me.getGroupId(), me.getArtifactId(), me.getVersion(), me.getExecutionId()); } }
public String getId() { return mojoExecution.getGroupId() + ":" + mojoExecution.getArtifactId() + ":" + mojoExecution.getVersion() + " (" + mojoExecution.getExecutionId() + ") "; }
public boolean handle(@Nonnull Object event) { if (!(event instanceof ExecutionEvent)) { return false; } ExecutionEvent executionEvent = (ExecutionEvent) event; ExecutionEvent.Type supportedType = getSupportedType(); if (supportedType != null && !(supportedType.equals(executionEvent.getType()))) { return false; } String supportedGoal = getSupportedPluginGoal(); if (supportedGoal == null) { return _handle(executionEvent); } else { String[] gag = supportedGoal.split(":"); if (gag.length == 3) { MojoExecution execution = executionEvent.getMojoExecution(); if (execution.getGroupId().equals(gag[0]) && execution.getArtifactId().equals(gag[1]) && execution.getGoal().equals(gag[2])) { _handle(executionEvent); return true; } else { return false; } } else { reporter.print(toString() + " - unsupported supportedPluginGoal:" + supportedGoal); return false; } } }
/** * @see org.apache.maven.execution.ExecutionListener#forkFailed(org.apache.maven.execution.ExecutionEvent) */ public void forkFailed( ExecutionEvent event ) { maven3Builder.listener.getLogger().println("mojo forkFailed " + event.getMojoExecution().getGroupId() + ":" + event.getMojoExecution().getArtifactId() + ":" + event.getMojoExecution().getVersion() + "(" + event.getMojoExecution().getExecutionId() + ")"); reccordMojoFailed( event ); }
/** * @see org.apache.maven.execution.ExecutionListener#mojoSkipped(org.apache.maven.execution.ExecutionEvent) */ public void mojoSkipped( ExecutionEvent event ) { maven3Builder.listener.getLogger().println("mojoSkipped " + event.getMojoExecution().getGroupId() + ":" + event.getMojoExecution().getArtifactId() + ":" + event.getMojoExecution().getVersion() + "(" + event.getMojoExecution().getExecutionId() + ")"); this.eventLogger.mojoSkipped( event ); }
/** * @see org.apache.maven.execution.ExecutionListener#forkStarted(org.apache.maven.execution.ExecutionEvent) */ public void forkStarted( ExecutionEvent event ) { maven3Builder.listener.getLogger().println("mojo forkStarted " + event.getMojoExecution().getGroupId() + ":" + event.getMojoExecution().getArtifactId() + ":" + event.getMojoExecution().getVersion() + "(" + event.getMojoExecution().getExecutionId() + ")"); reccordMojoStarted( event ); }
/** * @see org.apache.maven.execution.ExecutionListener#forkSucceeded(org.apache.maven.execution.ExecutionEvent) */ public void forkSucceeded( ExecutionEvent event ) { maven3Builder.listener.getLogger().println("mojo forkSucceeded " + event.getMojoExecution().getGroupId() + ":" + event.getMojoExecution().getArtifactId() + ":" + event.getMojoExecution().getVersion() + "(" + event.getMojoExecution().getExecutionId() + ")"); reccordMojoSucceeded( event ); }
/** * @see org.apache.maven.execution.ExecutionListener#mojoFailed(org.apache.maven.execution.ExecutionEvent) */ public void mojoFailed( ExecutionEvent event ) { maven3Builder.listener.getLogger().println("mojoFailed " + event.getMojoExecution().getGroupId() + ":" + event.getMojoExecution().getArtifactId() + ":" + event.getMojoExecution().getVersion() + "(" + event.getMojoExecution().getExecutionId() + ")"); reccordMojoFailed( event ); this.eventLogger.mojoFailed( event ); }
root.addChild(plugin); plugin.setAttribute("groupId", execution.getGroupId()); plugin.setAttribute("artifactId", execution.getArtifactId()); plugin.setAttribute("goal", execution.getGoal());
@Override public void configure(MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig) { String groupId = mojoExecution.getGroupId(); String artifactId = mojoExecution.getArtifactId(); Plugin plugin = findPlugin(groupId, artifactId, project.getBuildPlugins());
@Override public void configure(MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig) { String groupId = mojoExecution.getGroupId(); String artifactId = mojoExecution.getArtifactId(); Plugin plugin = findPlugin(groupId, artifactId, project.getBuildPlugins());