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 ); } }
/** * {@inheritDoc} */ public void execute( File destinationDirectory, PluginToolsRequest request ) throws GeneratorException { // eventually rewrite help mojo class to match actual package name PluginHelpGenerator.rewriteHelpMojo( request, log ); try { // write complete plugin.xml descriptor File f = new File( destinationDirectory, "plugin.xml" ); writeDescriptor( f, request, false ); // write plugin-help.xml help-descriptor MavenProject mavenProject = request.getProject(); f = new File( mavenProject.getBuild().getOutputDirectory(), PluginHelpGenerator.getPluginHelpPath( mavenProject ) ); writeDescriptor( f, request, true ); } catch ( IOException e ) { throw new GeneratorException( e.getMessage(), e ); } catch ( DuplicateMojoDescriptorException e ) { throw new GeneratorException( e.getMessage(), e ); } }
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 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 mojos = getComponents(); if ( mojos != null && mojos.contains( mojoDescriptor ) ) { int indexOf = mojos.indexOf( mojoDescriptor ); existing = (MojoDescriptor) mojos.get( indexOf ); } if ( existing != null ) { throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing .getImplementation(), mojoDescriptor.getImplementation() ); } else { addComponentDescriptor( mojoDescriptor ); } }
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 ); } }