public void releaseMojo( Object mojo, MojoExecution mojoExecution ) { if ( mojo != null ) { try { container.release( mojo ); } catch ( ComponentLifecycleException e ) { String goalExecId = mojoExecution.getGoal(); if ( mojoExecution.getExecutionId() != null ) { goalExecId += " {execution: " + mojoExecution.getExecutionId() + "}"; } logger.debug( "Error releasing mojo for " + goalExecId, e ); } } }
private static String constructMessage( MojoExecution mojoExecution, Throwable cause ) { String message; if ( mojoExecution != null ) { message = "Execution " + mojoExecution.getExecutionId() + " of goal " + mojoExecution.getMojoDescriptor().getId() + " failed"; } else { message = "Mojo execution failed"; } if ( cause != null && StringUtils.isNotEmpty( cause.getMessage() ) ) { message += ": " + cause.getMessage(); } else { message += "."; } return message; }
private void append( MessageBuilder buffer, MojoExecution me ) { buffer.mojo( me.getArtifactId() + ':' + me.getVersion() + ':' + me.getGoal() ); if ( me.getExecutionId() != null ) { buffer.a( ' ' ).strong( '(' + me.getExecutionId() + ')' ); } }
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(); }
new MojoExecution( forkedMojoDescriptor, mojoExecution.getExecutionId() );
@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 ); } }
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; } } MOJOS.add(execution); }
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( ')' ); } }
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( ')' ); } }
public MojoExecutionName(MojoExecution mojoExecution) { name = String.format(Locale.ENGLISH, "%s:%s (%s)", mojoExecution.getArtifactId(), mojoExecution.getGoal(), mojoExecution.getExecutionId()); }
/** * Returns conventional MojoExecution identifier used by incremental build tools. */ public String getExecutionId(MojoExecution execution) { PluginDescriptor pluginDescriptor = execution.getMojoDescriptor().getPluginDescriptor(); StringBuilder builderId = new StringBuilder(); builderId.append(pluginDescriptor.getGroupId()).append('_') .append(pluginDescriptor.getArtifactId()); builderId.append('_').append(execution.getGoal()).append('_') .append(execution.getExecutionId()); return builderId.toString(); }
/** * Acquires the staleFile for this execution * * @return the staleFile (used to define where) for this execution */ protected final File getStaleFile() { final String staleFileName = "." + (getExecution() == null ? "nonExecutionJaxb" : getExecution().getExecutionId()) + "-" + getStaleFileName(); return new File(staleFileDirectory, staleFileName); }
private void append( MessageBuilder buffer, MojoExecution me ) { buffer.mojo( me.getArtifactId() + ':' + me.getVersion() + ':' + me.getGoal() ); if ( me.getExecutionId() != null ) { buffer.a( ' ' ).strong( '(' + me.getExecutionId() + ')' ); } }
/** * @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#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#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 ); }
private void recordMojoStarted( final ExecutionEvent event ) { if( ExecutionEvent.Type.MojoStarted.equals(event.getType()) ) { MojoExecution mojoExecution = event.getMojoExecution(); ProjectLogger.log(event.getProject(), "mojo started - " + mojoExecution.getLifecyclePhase() + " " + mojoExecution.getArtifactId() + " " + mojoExecution.getExecutionId() ); // There are none. //log.debug("Mojo Plugin deps: {}", mojoExecution.getPlugin().getDependencies()); } }