public String getGoal() { if ( mojoDescriptor != null ) { return mojoDescriptor.getGoal(); } return goal; }
/** * @return the full goal name * @see PluginDescriptor#getGoalPrefix() * @see #getGoal() */ public String getFullGoalName() { return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); }
/** * @return the id of the mojo, based on the goal name */ public String getId() { return getPluginDescriptor().getId() + ":" + getGoal(); }
/** {@inheritDoc} */ public int hashCode() { int result = 1; String goal = getGoal(); if ( goal != null ) { result += goal.hashCode(); } PluginDescriptor pd = getPluginDescriptor(); if ( pd != null ) { result -= pd.hashCode(); } return result; }
private static String toMessage( String goal, PluginDescriptor pluginDescriptor ) { StringBuilder buffer = new StringBuilder( 256 ); buffer.append( "Could not find goal '" ).append( goal ).append( '\'' ); if ( pluginDescriptor != null ) { buffer.append( " in plugin " ).append( pluginDescriptor.getId() ); buffer.append( " among available goals " ); List<MojoDescriptor> mojos = pluginDescriptor.getMojos(); if ( mojos != null ) { for ( Iterator<MojoDescriptor> it = mojos.iterator(); it.hasNext(); ) { MojoDescriptor mojo = it.next(); if ( mojo != null ) { buffer.append( mojo.getGoal() ); } if ( it.hasNext() ) { buffer.append( ", " ); } } } } return buffer.toString(); }
public MojoDescriptor getMojo( String goal ) { if ( getMojos() == null ) { return null; // no mojo in this POM } // TODO could we use a map? Maybe if the parent did that for components too, as this is too vulnerable to // changes above not being propagated to the map for ( MojoDescriptor desc : getMojos() ) { if ( goal.equals( desc.getGoal() ) ) { return desc; } } return null; }
/** * @param parameter add a new parameter * @throws DuplicateParameterException if any */ public void addParameter( Parameter parameter ) throws DuplicateParameterException { if ( parameters != null && parameters.contains( parameter ) ) { throw new DuplicateParameterException( parameter.getName() + " has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: " + getImplementation() + ")" ); } if ( parameters == null ) { parameters = new LinkedList<>(); } parameters.add( parameter ); }
/** * @return the id of the mojo, based on the goal name */ public String getId() { return getPluginDescriptor().getId() + ":" + getGoal(); }
public MojoDescriptor getMojo( String goal ) { if ( getMojos() == null ) { return null; // no mojo in this POM } // TODO could we use a map? Maybe if the parent did that for components too, as this is too vulnerable to // changes above not being propagated to the map for ( MojoDescriptor desc : getMojos() ) { if ( goal.equals( desc.getGoal() ) ) { return desc; } } return null; }
/** * @return the full goal name * @see PluginDescriptor#getGoalPrefix() * @see #getGoal() */ public String getFullGoalName() { return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); }
/** {@inheritDoc} */ public int hashCode() { int result = 1; String goal = getGoal(); if ( goal != null ) { result += goal.hashCode(); } PluginDescriptor pd = getPluginDescriptor(); if ( pd != null ) { result -= pd.hashCode(); } return result; }
public String buildDiagnosticMessage() { StringBuilder messageBuffer = new StringBuilder( 256 ); List<Parameter> params = getParameters(); MojoDescriptor mojo = getMojoDescriptor(); messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" ) .append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ':' ).append( mojo.getGoal() ) .append( "\'\n" ); int idx = 0; for ( Iterator<Parameter> it = params.iterator(); it.hasNext(); idx++ ) { Parameter param = it.next(); messageBuffer.append( "\n[" ).append( idx ).append( "] " ); decomposeParameterIntoUserInstructions( mojo, param, messageBuffer ); messageBuffer.append( '\n' ); } return messageBuffer.toString(); } }
/** {@inheritDoc} */ public boolean equals( Object object ) { if ( this == object ) { return true; } if ( object instanceof MojoDescriptor ) { MojoDescriptor other = (MojoDescriptor) object; if ( !compareObjects( getPluginDescriptor(), other.getPluginDescriptor() ) ) { return false; } return compareObjects( getGoal(), other.getGoal() ); } return false; }
/** {@inheritDoc} */ public boolean equals( Object object ) { if ( this == object ) { return true; } if ( object instanceof MojoDescriptor ) { MojoDescriptor other = (MojoDescriptor) object; if ( !compareObjects( getPluginDescriptor(), other.getPluginDescriptor() ) ) { return false; } return compareObjects( getGoal(), other.getGoal() ); } return false; }
public void addMojo( MojoDescriptor mojoDescriptor ) throws DuplicateMojoDescriptorException { MojoDescriptor existing = null; // this relies heavily on the equals() and hashCode() for ComponentDescriptor, // which uses role:roleHint for identity...and roleHint == goalPrefix:goal. // role does not vary for Mojos. List<MojoDescriptor> mojos = getMojos(); if ( mojos != null && mojos.contains( mojoDescriptor ) ) { int indexOf = mojos.indexOf( mojoDescriptor ); existing = mojos.get( indexOf ); } if ( existing != null ) { throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing.getImplementation(), mojoDescriptor.getImplementation() ); } else { addComponentDescriptor( mojoDescriptor ); } }
public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project, PlexusContainerException cause ) { super( message, cause ); this.project = project; PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); pluginGroupId = pd.getGroupId(); pluginArtifactId = pd.getArtifactId(); pluginVersion = pd.getVersion(); goal = mojoDescriptor.getGoal(); }
protected PluginManagerException( MojoDescriptor mojoDescriptor, String message, Throwable cause ) { super( message, cause ); pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message ) { super( message ); this.project = project; pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, Throwable cause ) { super( message, cause ); this.project = project; pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
public PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, NoSuchRealmException cause ) { super( message, cause ); this.project = project; pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }