Refine search
throws PlexusConfigurationException Parameter parameter = new Parameter(); parameter.setName( d.getChild( "name" ).getValue() ); parameter.setAlias( d.getChild( "alias" ).getValue() ); parameter.setType( d.getChild( "type" ).getValue() ); parameter.setRequired( Boolean.parseBoolean( required ) ); parameter.setEditable( editable == null || Boolean.parseBoolean( editable ) ); parameter.setDescription( d.getChild( "description" ).getValue() ); parameter.setDeprecated( d.getChild( "deprecated" ).getValue() ); parameter.setImplementation( d.getChild( "implementation" ).getValue() ); parameter.setSince( d.getChild( "since" ).getValue() ); PlexusConfiguration paramConfig = mojoConfig.getChild( parameter.getName(), false ); if ( paramConfig != null ) parameter.setExpression( paramConfig.getValue( null ) ); parameter.setDefaultValue( paramConfig.getAttribute( "default-value" ) );
private static void decomposeParameterIntoUserInstructions( MojoDescriptor mojo, Parameter param, StringBuilder messageBuffer ) String expression = param.getExpression(); if ( param.isEditable() ) boolean isArray = param.getType().endsWith( "[]" ); boolean isCollection = false; boolean isMap = false; isCollection = Collection.class.isAssignableFrom( Class.forName( param.getType() ) ); isMap = Map.class.isAssignableFrom( Class.forName( param.getType() ) ); isProperties = Properties.class.isAssignableFrom( Class.forName( param.getType() ) ); messageBuffer.append( mojo.getPluginDescriptor().getArtifactId() ); messageBuffer.append( "\', specify the following:\n\n<configuration>\n ...\n" ); messageBuffer.append( " <" ).append( param.getName() ).append( '>' ); if ( isArray || isCollection ) messageBuffer.append( " " ); messageBuffer.append( "</" ).append( param.getName() ).append( ">\n" ); messageBuffer.append( "</configuration>" ); String alias = param.getAlias(); if ( StringUtils.isNotEmpty( alias ) && !alias.equals( param.getName() ) ) if ( param.isEditable() )
ValidatingConfigurationListener( Object mojo, MojoDescriptor mojoDescriptor, ConfigurationListener delegate ) { this.mojo = mojo; this.delegate = delegate; this.missingParameters = new HashMap<>(); if ( mojoDescriptor.getParameters() != null ) { for ( Parameter param : mojoDescriptor.getParameters() ) { if ( param.isRequired() ) { missingParameters.put( param.getName(), param ); } } } }
String expression = parameter.getExpression(); requirements.put( parameter.getName(), new Requirement( role, roleHint ) ); else if ( parameter.getRequirement() != null ) requirements.put( parameter.getName(), parameter.getRequirement() ); PluginUtils.element( w, "name", parameter.getName() ); if ( parameter.getAlias() != null ) PluginUtils.element( w, "alias", parameter.getAlias() ); PluginUtils.element( w, "type", parameter.getType() ); if ( parameter.getDeprecated() != null ) if ( StringUtils.isEmpty( parameter.getDeprecated() ) ) PluginUtils.element( w, "deprecated", parameter.getDeprecated() ); if ( parameter.getImplementation() != null ) PluginUtils.element( w, "implementation", parameter.getImplementation() ); PluginUtils.element( w, "required", Boolean.toString( parameter.isRequired() ) ); PluginUtils.element( w, "editable", Boolean.toString( parameter.isEditable() ) );
Parameter pd = new Parameter(); pd.setType( type.getValue() ); pd.setType( value.toString() ); pd.setDescription( field.getComment() ); pd.setRequirement( new Requirement( role, roleHint ) ); pd.setName( (String) entry.getKey() ); pd.setName( property ); pd.setName( (String) entry.getKey() ); pd.setRequired( field.getTagByName( REQUIRED ) != null ); pd.setEditable( field.getTagByName( READONLY ) == null ); pd.setDeprecated( deprecationTag.getValue() ); pd.setSince( sinceTag.getValue() ); pd.setAlias( alias ); pd.setExpression( parameter.getNamedParameter( PARAMETER_EXPRESSION ) ); if ( "${reports}".equals( pd.getExpression() ) )
private MojoDescriptor asDescriptor( File metadataFile, Mojo mojo ) throws PluginMetadataParseException MojoDescriptor descriptor = new MojoDescriptor(); descriptor.setGoal( mojo.getGoal() ); descriptor.setPhase( mojo.getPhase() ); descriptor.setDependencyResolutionRequired( mojo.getRequiresDependencyResolution() ); descriptor.setAggregator( mojo.isAggregator() ); (org.apache.maven.plugin.tools.model.Parameter) it.next(); Parameter dParam = new Parameter(); dParam.setAlias( param.getAlias() ); dParam.setDeprecated( param.getDeprecation() ); dParam.setDescription( param.getDescription() ); dParam.setEditable( !param.isReadonly() ); dParam.setExpression( param.getExpression() ); dParam.setDefaultValue( param.getDefaultValue() ); dParam.setName( property ); dParam.setName( param.getName() ); if ( StringUtils.isEmpty( dParam.getName() ) ) dParam.setRequired( param.isRequired() ); dParam.setType( param.getType() );
Parameter param = new Parameter(); param.setName( "detail" ); param.setType( "boolean" ); param.setDescription( "If <code>true</code>, display all settable properties for each goal." ); param.setDefaultValue( "false" ); param.setExpression( "${detail}" ); param = new Parameter(); param.setName( "goal" ); param.setType( "java.lang.String" ); param.setDescription( "The name of the goal for which to show help." + " If unspecified, all goals will be displayed." ); param.setExpression( "${goal}" ); param = new Parameter(); param.setName( "lineLength" ); param.setType( "int" ); param.setDescription( "The maximum length of a display line, should be positive." ); param.setDefaultValue( "80" ); param.setExpression( "${lineLength}" ); param = new Parameter(); param.setName( "indentSize" ); param.setType( "int" ); param.setDescription( "The number of spaces per indentation level, should be positive." ); param.setDefaultValue( "2" ); param.setExpression( "${indentSize}" );
Parameter parameter = new Parameter(); parameter.setName( jField.getName() ); parameter.setType( jField.getType() ); parameter.setDescription( jField.getDescription() ); parameter.setDeprecated( jField.getDeprecated() ); parameter.setSince( jField.getSince() ); parameter.setRequired( jField.hasAnnotation( Required.class ) ); parameter.setEditable( !jField.hasAnnotation( NonEditable.class ) ); if ( !parameter.isEditable() ) parameter.setAlias( alias.value() ); if ( property != null ) if ( !parameter.isEditable() ) parameter.setExpression( "${" + property.value() + "}" ); if ( defaultValue != null ) parameter.setDefaultValue( defaultValue.value() ); else if ( !parameter.isEditable() )
/** * * @param parameterList * @param w */ private void writeParameterDetails(List<Parameter> parameterList, ConfluenceWikiWriter w) { w.printNormalHeading("Parameter Details"); w.printNewParagraph(); for (Parameter parameter : parameterList) { w.printSmallHeading(createAnchor(parameter.getName(), parameter.getName())); String description = parameter.getDescription(); if (StringUtils.isEmpty(description)) { description = "No Description."; } w.println(decode(description)); writeDetail("Deprecated", parameter.getDeprecated(), w); writeDetail("Type", parameter.getType(), w); writeDetail("Since", parameter.getSince(), w); if (parameter.isRequired()) { writeDetail("Required", "Yes", w); } else { writeDetail("Required", "No", w); } writeDetail("Expression", parameter.getExpression(), w); writeDetail("Default", parameter.getDefaultValue(), w); } }
Parameter param = new Parameter(); param.setName( "basedir" ); param.setAlias( "ant.basedir" ); param.setExpression( "${antBasedir}" ); param.setDefaultValue( "${basedir}" ); param.setType( "java.io.File" ); param.setDescription( "The base directory from which to execute the Ant script." ); param.setEditable( true ); param.setRequired( true ); Parameter param = new Parameter(); param.setName( "messageLevel" ); param.setAlias( "ant.messageLevel" ); param.setExpression( "${antMessageLevel}" ); param.setDefaultValue( "info" ); param.setType( "java.lang.String" ); param.setDescription( "The message-level used to tune the verbosity of Ant logging." ); param.setEditable( true ); param.setRequired( false ); Parameter param = new Parameter(); param.setName( "project" ); param.setDefaultValue( "${project}" ); param.setType( MavenProject.class.getName() ); param.setDescription( "The current MavenProject instance, which contains classpath " + "elements." ); param.setEditable( false ); param.setRequired( true );
Parameter parameter = new Parameter(); parameter.setName( d.getChild( "name" ).getValue() ); parameter.setAlias( d.getChild( "alias" ).getValue() ); parameter.setType( d.getChild( "type" ).getValue() ); parameter.setRequired( Boolean.parseBoolean( required ) ); parameter.setEditable( editable == null || Boolean.parseBoolean( editable ) ); parameter.setDescription( d.getChild( "description" ).getValue() ); parameter.setDeprecated( d.getChild( "deprecated" ).getValue() ); parameter.setImplementation( d.getChild( "implementation" ).getValue() ); if ( param != null ) param.setDefaultValue( config.getAttribute( "default-value", null ) ); param.setExpression( config.getValue( null ) );
new org.apache.maven.plugin.descriptor.Parameter(); String name = StringUtils.isEmpty( parameterAnnotationContent.name() ) ? parameterAnnotationContent.getFieldName() : parameterAnnotationContent.name(); parameter.setName( name ); parameter.setAlias( parameterAnnotationContent.alias() ); parameter.setDefaultValue( parameterAnnotationContent.defaultValue() ); parameter.setDeprecated( parameterAnnotationContent.getDeprecated() ); parameter.setDescription( parameterAnnotationContent.getDescription() ); parameter.setEditable( !parameterAnnotationContent.readonly() ); String property = parameterAnnotationContent.property(); if ( StringUtils.contains( property, '$' ) || StringUtils.contains( property, '{' ) "Invalid property for parameter '" + parameter.getName() + "', " + "forbidden characters ${}: " + property, null ); parameter.setExpression( StringUtils.isEmpty( property ) ? "" : "${" + property + "}" ); parameter.setType( parameterAnnotationContent.getClassName() ); parameter.setSince( parameterAnnotationContent.getSince() ); parameter.setRequired( parameterAnnotationContent.required() ); new org.apache.maven.plugin.descriptor.Parameter(); parameter.setName( componentAnnotationContent.getFieldName() ); parameter.setRequirement( new Requirement( componentAnnotationContent.getRoleClassName(), componentAnnotationContent.hint() ) ); getLogger().warn( "Deprecated @Component annotation for '" + parameter.getName() + "' field in " + mojoAnnotatedClass.getClassName()
private static MojoParameter toMojoParameter(Parameter parameter) { MojoParameter result = new MojoParameter(); result.setName(parameter.getName()); result.setAlias(parameter.getAlias()); result.setType(parameter.getType()); result.setRequired(parameter.isRequired()); result.setEditable(parameter.isEditable()); result.setDescription(parameter.getDescription()); result.setDeprecated(parameter.getDeprecated()); result.setSince(parameter.getSince()); result.setImplementation(parameter.getImplementation()); result.setDefaultValue(parameter.getDefaultValue()); result.setExpression(parameter.getExpression()); return result; }
MojoComponent component = d.getAnnotation(MojoComponent.class); if (parameter != null || component != null) { pd.setName(propertyName); pd.setType(propertyType); } else { return; pd.setDescription(description); String role = component.role(); if (role.length() == 0) { pd.setRequirement(new Requirement(role, roleHint)); pd.setName(propertyName); } else { String description = parameter.description(); pd.setDescription(description); String property = parameter.property(); if (!StringUtils.isEmpty(property)) { pd.setName(property); } else { pd.setName(propertyName); pd.setRequired(parameter.required()); pd.setEditable(!parameter.readonly()); String deprecated = parameter.deprecated(); if (!StringUtils.isEmpty(deprecated)) { pd.setDeprecated(deprecated);
/** * @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 ); }
if ( mojoDescriptor.getParameters() != null ) for ( Parameter parameter : mojoDescriptor.getParameters() ) Xpp3Dom parameterConfiguration = executionConfiguration.getChild( parameter.getName() ); parameterConfiguration = executionConfiguration.getChild( parameter.getAlias() ); Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() ); parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() ); && StringUtils.isNotEmpty( parameter.getImplementation() ) ) parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() );
throws IOException for ( Iterator it = helpDescriptor.getParameters().iterator(); it.hasNext(); ) writer.write( " * " + StringUtils.escape( param.getDescription() ) + LS ); writer.write( " * " + LS ); writer.write( " * @parameter" ); if ( StringUtils.isNotEmpty( param.getExpression() ) ) writer.write( StringUtils.escape( param.getExpression() ) ); writer.write( "\"" ); if ( StringUtils.isNotEmpty( param.getDefaultValue() ) ) writer.write( StringUtils.escape( param.getDefaultValue() ) ); writer.write( "\"" ); writer.write( " private " + param.getType() + " " + param.getName() + ";" + LS ); writer.write( LS );
if ( param.getDescription() != null ) jField.setDescription( param.getDescription() ); if ( param.getDeprecated() != null ) jField.setDeprecated( param.getDeprecated() ); if ( param.getSince() != null ) jField.setSince( param.getSince() ); if ( !param.isEditable() && !jField.hasAnnotation( NonEditable.class ) ) if ( param.isRequired() && !jField.hasAnnotation( Required.class ) ) if ( param.getAlias() != null && !jField.hasAnnotation( Alias.class ) ) jField.addAnnotation( new JAnnotation( Alias.class, param.getAlias() ) ); if ( param.getDefaultValue() != null && !jField.hasAnnotation( DefaultsTo.class ) ) jField.addAnnotation( new JAnnotation( DefaultsTo.class, param.getDefaultValue() ) ); if ( param.getExpression() != null ) String exp = param.getExpression(); if ( exp.matches( "\\$\\{[^}]+\\}" ) )
w.writeMarkup( format( "pluginxdoc.mojodescriptor.parameter.name_link", parameter.getName() ) ); int index = parameter.getType().lastIndexOf( "." ); w.writeMarkup( "<code>" + parameter.getType().substring( index + 1 ) + "</code>" ); if ( StringUtils.isNotEmpty( parameter.getSince() ) ) w.writeMarkup( "<code>" + parameter.getSince() + "</code>" ); if ( StringUtils.isNotEmpty( mojoDescriptor.getSince() ) ) w.writeMarkup( "<code>" + mojoDescriptor.getSince() + "</code>" ); if ( StringUtils.isNotEmpty( parameter.getDeprecated() ) ) PluginUtils.makeHtmlValid( parameter.getDeprecated() ) ); else if ( StringUtils.isNotEmpty( parameter.getDescription() ) ) description = PluginUtils.makeHtmlValid( parameter.getDescription() ); if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) ) escapeXml( parameter.getDefaultValue() ) ) );