/** * @return the full goal name * @see PluginDescriptor#getGoalPrefix() * @see #getGoal() */ public String getFullGoalName() { return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); }
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(); } }
/** * @return the full goal name * @see PluginDescriptor#getGoalPrefix() * @see #getGoal() */ public String getFullGoalName() { return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); }
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<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 ); } }
private PluginPrefixResult resolveFromProject( PluginPrefixRequest request, List<Plugin> plugins ) { for ( Plugin plugin : plugins ) { try { PluginDescriptor pluginDescriptor = pluginManager.loadPlugin( plugin, request.getRepositories(), request.getRepositorySession() ); if ( request.getPrefix().equals( pluginDescriptor.getGoalPrefix() ) ) { return new DefaultPluginPrefixResult( plugin ); } } catch ( Exception e ) { if ( logger.isDebugEnabled() ) { logger.warn( "Failed to retrieve plugin descriptor for " + plugin.getId() + ": " + e.getMessage(), e ); } else { logger.warn( "Failed to retrieve plugin descriptor for " + plugin.getId() + ": " + e.getMessage() ); } } } return null; }
protected static PluginDescriptor clone( PluginDescriptor original ) { PluginDescriptor clone = null; if ( original != null ) { clone = new PluginDescriptor(); clone.setGroupId( original.getGroupId() ); clone.setArtifactId( original.getArtifactId() ); clone.setVersion( original.getVersion() ); clone.setGoalPrefix( original.getGoalPrefix() ); clone.setInheritedByDefault( original.isInheritedByDefault() ); clone.setName( original.getName() ); clone.setDescription( original.getDescription() ); clone.setRequiredMavenVersion( original.getRequiredMavenVersion() ); clone.setPluginArtifact( ArtifactUtils.copyArtifactSafe( original.getPluginArtifact() ) ); clone.setComponents( clone( original.getMojos(), clone ) ); clone.setId( original.getId() ); clone.setIsolatedRealm( original.isIsolatedRealm() ); clone.setSource( original.getSource() ); clone.setDependencies( original.getDependencies() ); } return clone; }
/** * @return the full goal name * @see PluginDescriptor#getGoalPrefix() * @see #getGoal() */ public String getFullGoalName() { return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); }
public static InputStream getWorkflowDescriptor(String goalName, PluginDescriptor pluginDescriptor, Optional<File> customWorkflowDescriptor, Logger log) throws MojoExecutionException { log.info("Constructing workflow for processing"); String goalPrefix = pluginDescriptor.getGoalPrefix(); if (customWorkflowDescriptor.isPresent()) { File customDescriptor = customWorkflowDescriptor.get(); log.debug("Requested overriding of workflow with file: " + customDescriptor.getAbsolutePath()); if (customDescriptor.exists() && customDescriptor.isFile()) { try { log.info("Workflow of goal '" + goalPrefix + ':' + goalName + "' will be overriden by file '" + customDescriptor.getAbsolutePath() + "'."); return new FileInputStream(customDescriptor); } catch (Exception e) { throw new MojoExecutionException("Unable to load custom workflow for goal " + goalName, e); } } else { throw new MojoExecutionException("Unable to load custom workflow for goal " + goalPrefix + ':' + goalName + ". The workflow file '" + customDescriptor.getAbsolutePath() + "' does not exist!"); } } log.info("Goal '" + goalPrefix + ':' + goalName + "' will use default workflow packaged with the plugin."); return Thread.currentThread().getContextClassLoader().getResourceAsStream(DEFAULT_WORKFLOW_DIR + "/" + goalName); }
/** * @return the full goal name * @see PluginDescriptor#getGoalPrefix() * @see #getGoal() */ public String getFullGoalName() { return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); }
public static void printWorkflow(String goalName, PluginDescriptor pluginDescriptor, Optional<File> customWorkflowDescriptor, Logger log) throws MojoExecutionException { StringBuilder sb = new StringBuilder(); if (StringUtils.isNotBlank(pluginDescriptor.getGoalPrefix())) { sb.append(pluginDescriptor.getGoalPrefix()); } else { sb.append(pluginDescriptor.getGroupId()).append(':').append(pluginDescriptor.getArtifactId()).append(':') .append(pluginDescriptor.getVersion()); } sb.append(':').append(goalName); log.info("Default workflow for '" + sb + "':"); InputStream workflowDescriptor = getWorkflowDescriptor(goalName, pluginDescriptor, customWorkflowDescriptor, log); try { int x = 77 - goalName.length(); int a = x / 2; int b = x % 2 == 1 ? a + 1 : a; StringBuilder separator = new StringBuilder(); separator.append(Strings.repeat("=", a)).append(' ').append(goalName).append(' ').append(Strings.repeat("=", b)); System.out.println(separator); ByteStreams.copy(workflowDescriptor, System.out); System.out.println(separator); } catch (IOException e) { throw new MojoExecutionException("A problem occurred during the serialization of the defualt workflow.", e); } finally { Closeables.closeQuietly(workflowDescriptor); } }
properties.put( "goalPrefix", pluginDescriptor.getGoalPrefix() ); properties.put( "useAnnotations", useAnnotations );
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 ); } }
PluginUtils.element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );
PluginUtils.element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );
GeneratorUtils.element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );