mirror of https://github.com/apache/maven.git
remove more deprecated stuff, improve plugin xdoc generation
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169734 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e15ca2b246
commit
640ee60806
|
@ -23,23 +23,19 @@ package org.apache.maven.plugin.descriptor;
|
||||||
public class Parameter
|
public class Parameter
|
||||||
{
|
{
|
||||||
private String alias;
|
private String alias;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private boolean required;
|
private boolean required;
|
||||||
|
|
||||||
private boolean editable = true;
|
|
||||||
|
|
||||||
private String validator;
|
private boolean editable = true;
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private String expression;
|
private String expression;
|
||||||
|
|
||||||
private String defaultValue;
|
|
||||||
|
|
||||||
private String deprecated;
|
private String deprecated;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -76,16 +72,6 @@ public class Parameter
|
||||||
this.required = required;
|
this.required = required;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValidator()
|
|
||||||
{
|
|
||||||
return validator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValidator( String validator )
|
|
||||||
{
|
|
||||||
this.validator = validator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return description;
|
return description;
|
||||||
|
@ -106,16 +92,6 @@ public class Parameter
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultValue()
|
|
||||||
{
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaultValue( String defaultValue )
|
|
||||||
{
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeprecated()
|
public String getDeprecated()
|
||||||
{
|
{
|
||||||
return deprecated;
|
return deprecated;
|
||||||
|
@ -131,9 +107,9 @@ public class Parameter
|
||||||
return name.hashCode();
|
return name.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object other)
|
public boolean equals( Object other )
|
||||||
{
|
{
|
||||||
return (other instanceof Parameter) && getName().equals(((Parameter)other).getName());
|
return ( other instanceof Parameter ) && getName().equals( ( (Parameter) other ).getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlias()
|
public String getAlias()
|
||||||
|
@ -155,7 +131,7 @@ public class Parameter
|
||||||
{
|
{
|
||||||
this.editable = editable;
|
this.editable = editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']";
|
return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']";
|
||||||
|
|
|
@ -187,8 +187,6 @@ public class PluginDescriptorBuilder
|
||||||
parameter.setEditable( editable == null || Boolean.valueOf( editable ).booleanValue() );
|
parameter.setEditable( editable == null || Boolean.valueOf( editable ).booleanValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter.setValidator( d.getChild( "validator" ).getValue() );
|
|
||||||
|
|
||||||
parameter.setDescription( d.getChild( "description" ).getValue() );
|
parameter.setDescription( d.getChild( "description" ).getValue() );
|
||||||
|
|
||||||
parameter.setExpression( d.getChild( "expression" ).getValue() );
|
parameter.setExpression( d.getChild( "expression" ).getValue() );
|
||||||
|
|
|
@ -43,7 +43,7 @@ import java.util.List;
|
||||||
public class BeanGenerator
|
public class BeanGenerator
|
||||||
implements Generator
|
implements Generator
|
||||||
{
|
{
|
||||||
public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
|
public void execute( File destinationDirectory, PluginDescriptor pluginDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
|
for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
|
||||||
|
@ -53,7 +53,7 @@ public class BeanGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processPluginDescriptor( MojoDescriptor descriptor, String destinationDirectory )
|
protected void processPluginDescriptor( MojoDescriptor descriptor, File destinationDirectory )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
String implementation = descriptor.getImplementation();
|
String implementation = descriptor.getImplementation();
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.tools.plugin.generator;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||||
|
@ -26,6 +27,6 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public interface Generator
|
public interface Generator
|
||||||
{
|
{
|
||||||
void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
|
void execute( File destinationDirectory, PluginDescriptor pluginDescriptor )
|
||||||
throws IOException;
|
throws IOException;
|
||||||
}
|
}
|
|
@ -43,7 +43,7 @@ import java.util.Map;
|
||||||
public class PluginDescriptorGenerator
|
public class PluginDescriptorGenerator
|
||||||
implements Generator
|
implements Generator
|
||||||
{
|
{
|
||||||
public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
|
public void execute( File destinationDirectory, PluginDescriptor pluginDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
File f = new File( destinationDirectory, "plugin.xml" );
|
File f = new File( destinationDirectory, "plugin.xml" );
|
||||||
|
@ -257,9 +257,6 @@ public class PluginDescriptorGenerator
|
||||||
element( w, "deprecated", parameter.getDeprecated() );
|
element( w, "deprecated", parameter.getDeprecated() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: do we still need this?
|
|
||||||
element( w, "validator", parameter.getValidator() );
|
|
||||||
|
|
||||||
element( w, "required", Boolean.toString( parameter.isRequired() ) );
|
element( w, "required", Boolean.toString( parameter.isRequired() ) );
|
||||||
|
|
||||||
element( w, "editable", Boolean.toString( parameter.isEditable() ) );
|
element( w, "editable", Boolean.toString( parameter.isEditable() ) );
|
||||||
|
|
|
@ -33,23 +33,23 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo add example usage tag that can be shown in the doco
|
* @todo add example usage tag that can be shown in the doco
|
||||||
* @todo need to add validation directives so that systems embedding maven2 can
|
|
||||||
* get validation directives to help users in IDEs.
|
|
||||||
*/
|
*/
|
||||||
public class PluginXdocGenerator
|
public class PluginXdocGenerator
|
||||||
implements Generator
|
implements Generator
|
||||||
{
|
{
|
||||||
public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
|
public void execute( File destinationDirectory, PluginDescriptor pluginDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
// TODO: write an overview page
|
||||||
|
|
||||||
for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
|
for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
MojoDescriptor descriptor = (MojoDescriptor) it.next();
|
MojoDescriptor descriptor = (MojoDescriptor) it.next();
|
||||||
processPluginDescriptor( descriptor, destinationDirectory );
|
processMojoDescriptor( descriptor, destinationDirectory );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processPluginDescriptor( MojoDescriptor mojoDescriptor, String destinationDirectory )
|
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
String id = mojoDescriptor.getGoal();
|
String id = mojoDescriptor.getGoal();
|
||||||
|
@ -57,7 +57,7 @@ public class PluginXdocGenerator
|
||||||
FileWriter writer = null;
|
FileWriter writer = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = new FileWriter( new File( destinationDirectory, id + "-plugin.xml" ) );
|
writer = new FileWriter( new File( destinationDirectory, id + "-mojo.xml" ) );
|
||||||
|
|
||||||
writeBody( writer, id, mojoDescriptor );
|
writeBody( writer, id, mojoDescriptor );
|
||||||
|
|
||||||
|
@ -83,15 +83,8 @@ public class PluginXdocGenerator
|
||||||
|
|
||||||
w.startElement( "title" );
|
w.startElement( "title" );
|
||||||
|
|
||||||
w.writeText( "Documentation for the " + id + " plugin." );
|
// TODO: need a friendly name for a plugin
|
||||||
|
w.writeText( mojoDescriptor.getPluginDescriptor().getArtifactId() + " - " + mojoDescriptor.getFullGoalName() );
|
||||||
w.endElement();
|
|
||||||
|
|
||||||
w.startElement( "author" );
|
|
||||||
|
|
||||||
w.addAttribute( "email", "dev@maven.apache.org" );
|
|
||||||
|
|
||||||
w.writeText( "Maven development team." );
|
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
|
@ -103,34 +96,24 @@ public class PluginXdocGenerator
|
||||||
|
|
||||||
w.startElement( "section" );
|
w.startElement( "section" );
|
||||||
|
|
||||||
w.addAttribute( "name", "Goals" );
|
w.addAttribute( "name", mojoDescriptor.getFullGoalName() );
|
||||||
|
|
||||||
w.startElement( "p" );
|
w.startElement( "p" );
|
||||||
|
|
||||||
w.writeText( "The goals for the " + id + " are as follows:" );
|
|
||||||
|
|
||||||
w.endElement();
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
w.startElement( "subsection" );
|
|
||||||
|
|
||||||
w.addAttribute( "name", mojoDescriptor.getGoal() );
|
|
||||||
|
|
||||||
if ( mojoDescriptor.getDescription() != null )
|
if ( mojoDescriptor.getDescription() != null )
|
||||||
{
|
{
|
||||||
w.startElement( "p" );
|
w.writeMarkup( mojoDescriptor.getDescription() );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getDescription() );
|
|
||||||
|
|
||||||
w.endElement();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
w.writeText( "No description." );
|
||||||
|
}
|
||||||
|
|
||||||
|
w.endElement();
|
||||||
|
|
||||||
w.startElement( "p" );
|
w.startElement( "p" );
|
||||||
|
|
||||||
w.writeText( "These parameters for this goal: " );
|
w.writeText( "Parameters for the goal: " );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
|
@ -138,23 +121,11 @@ public class PluginXdocGenerator
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
w.endElement();
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w )
|
private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w )
|
||||||
{
|
{
|
||||||
w.startElement( "p" );
|
|
||||||
|
|
||||||
w.startElement( "table" );
|
w.startElement( "table" );
|
||||||
|
|
||||||
w.startElement( "tr" );
|
w.startElement( "tr" );
|
||||||
|
@ -183,24 +154,10 @@ public class PluginXdocGenerator
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
w.startElement( "th" );
|
|
||||||
|
|
||||||
w.writeText( "Required?" );
|
|
||||||
|
|
||||||
w.endElement();
|
|
||||||
|
|
||||||
w.startElement( "th" );
|
|
||||||
|
|
||||||
w.writeText( "Deprecated?" );
|
|
||||||
|
|
||||||
w.endElement();
|
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
List parameters = mojoDescriptor.getParameters();
|
List parameters = mojoDescriptor.getParameters();
|
||||||
|
|
||||||
Map parameterMap = mojoDescriptor.getParameterMap();
|
|
||||||
|
|
||||||
for ( int i = 0; i < parameters.size(); i++ )
|
for ( int i = 0; i < parameters.size(); i++ )
|
||||||
{
|
{
|
||||||
Parameter parameter = (Parameter) parameters.get( i );
|
Parameter parameter = (Parameter) parameters.get( i );
|
||||||
|
@ -220,27 +177,51 @@ public class PluginXdocGenerator
|
||||||
paramName = parameter.getName();
|
paramName = parameter.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w.startElement( "code" );
|
||||||
|
|
||||||
w.writeText( paramName );
|
w.writeText( paramName );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
|
if ( !parameter.isRequired() )
|
||||||
|
{
|
||||||
|
w.writeMarkup( " <i>(Optional)</i>");
|
||||||
|
}
|
||||||
|
|
||||||
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
w.startElement( "td" );
|
w.startElement( "td" );
|
||||||
|
|
||||||
|
w.startElement( "code" );
|
||||||
|
|
||||||
w.writeText( parameter.getType() );
|
w.writeText( parameter.getType() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
w.startElement( "td" );
|
w.startElement( "td" );
|
||||||
|
|
||||||
w.writeText( parameter.getExpression() );
|
w.startElement( "code" );
|
||||||
|
|
||||||
|
if ( StringUtils.isNotEmpty( parameter.getExpression() ) )
|
||||||
|
{
|
||||||
|
w.writeText( parameter.getExpression() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
w.writeText( "-" );
|
||||||
|
}
|
||||||
|
|
||||||
|
w.endElement();
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
|
@ -250,38 +231,32 @@ public class PluginXdocGenerator
|
||||||
|
|
||||||
w.startElement( "td" );
|
w.startElement( "td" );
|
||||||
|
|
||||||
w.writeText( parameter.getDescription() );
|
if ( StringUtils.isNotEmpty( parameter.getDescription() ) )
|
||||||
|
{
|
||||||
w.endElement();
|
w.writeMarkup( parameter.getDescription() );
|
||||||
|
}
|
||||||
// ----------------------------------------------------------------------
|
else
|
||||||
//
|
{
|
||||||
// ----------------------------------------------------------------------
|
w.writeText( "No description." );
|
||||||
|
}
|
||||||
w.startElement( "td" );
|
|
||||||
|
|
||||||
w.writeText( Boolean.toString( parameter.isRequired() ) );
|
|
||||||
|
|
||||||
w.endElement();
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
String deprecationWarning = parameter.getDeprecated();
|
String deprecationWarning = parameter.getDeprecated();
|
||||||
if ( StringUtils.isNotEmpty( deprecationWarning ) )
|
if ( deprecationWarning != null )
|
||||||
{
|
{
|
||||||
w.startElement( "td" );
|
w.writeMarkup( "<br/><b>Deprecated:</b> ");
|
||||||
|
w.writeMarkup( deprecationWarning );
|
||||||
w.writeText( deprecationWarning );
|
if ( deprecationWarning.length() == 0 )
|
||||||
|
{
|
||||||
|
w.writeText( "No reason given." );
|
||||||
|
}
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
}
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class JellyHarnessGenerator
|
||||||
return pluginDescriptor.getImplementation() + "Bean";
|
return pluginDescriptor.getImplementation() + "Bean";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
|
public void execute( File destinationDirectory, PluginDescriptor pluginDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
FileWriter writer = null;
|
FileWriter writer = null;
|
||||||
|
|
|
@ -58,7 +58,6 @@ public abstract class AbstractGeneratorTestCase
|
||||||
List params = new ArrayList();
|
List params = new ArrayList();
|
||||||
|
|
||||||
Parameter param = new Parameter();
|
Parameter param = new Parameter();
|
||||||
param.setDefaultValue( "value" );
|
|
||||||
param.setExpression( "${project.build.directory}" );
|
param.setExpression( "${project.build.directory}" );
|
||||||
param.setName( "dir" );
|
param.setName( "dir" );
|
||||||
param.setRequired( true );
|
param.setRequired( true );
|
||||||
|
@ -70,6 +69,7 @@ public abstract class AbstractGeneratorTestCase
|
||||||
mojoDescriptor.setParameters( params );
|
mojoDescriptor.setParameters( params );
|
||||||
|
|
||||||
PluginDescriptor pluginDescriptor = new PluginDescriptor();
|
PluginDescriptor pluginDescriptor = new PluginDescriptor();
|
||||||
|
mojoDescriptor.setPluginDescriptor( pluginDescriptor );
|
||||||
|
|
||||||
pluginDescriptor.addMojo( mojoDescriptor );
|
pluginDescriptor.addMojo( mojoDescriptor );
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public abstract class AbstractGeneratorTestCase
|
||||||
File tempFile = File.createTempFile( "testGenerator-outDir", ".marker.txt" ).getAbsoluteFile();
|
File tempFile = File.createTempFile( "testGenerator-outDir", ".marker.txt" ).getAbsoluteFile();
|
||||||
File destinationDirectory = tempFile.getParentFile();
|
File destinationDirectory = tempFile.getParentFile();
|
||||||
|
|
||||||
generator.execute( destinationDirectory.getAbsolutePath(), pluginDescriptor );
|
generator.execute( destinationDirectory, pluginDescriptor );
|
||||||
|
|
||||||
validate( destinationDirectory );
|
validate( destinationDirectory );
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,6 @@ public class Main
|
||||||
|
|
||||||
// Use the generator to process the discovered descriptors and produce
|
// Use the generator to process the discovered descriptors and produce
|
||||||
// something with them.
|
// something with them.
|
||||||
generator.execute( outputDirectory, pluginDescriptor );
|
generator.execute( new File( outputDirectory ), pluginDescriptor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.maven.tools.plugin.scanner.MojoScanner;
|
||||||
import org.apache.maven.tools.plugin.util.PluginUtils;
|
import org.apache.maven.tools.plugin.util.PluginUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
|
@ -52,7 +53,7 @@ public abstract class AbstractGeneratorMojo
|
||||||
*/
|
*/
|
||||||
protected String goalPrefix;
|
protected String goalPrefix;
|
||||||
|
|
||||||
protected abstract String getOutputDirectory();
|
protected abstract File getOutputDirectory();
|
||||||
|
|
||||||
protected abstract Generator createGenerator();
|
protected abstract Generator createGenerator();
|
||||||
|
|
||||||
|
@ -86,6 +87,8 @@ public abstract class AbstractGeneratorMojo
|
||||||
|
|
||||||
mojoScanner.populatePluginDescriptor( project, pluginDescriptor );
|
mojoScanner.populatePluginDescriptor( project, pluginDescriptor );
|
||||||
|
|
||||||
|
getOutputDirectory().mkdirs();
|
||||||
|
|
||||||
createGenerator().execute( getOutputDirectory(), pluginDescriptor );
|
createGenerator().execute( getOutputDirectory(), pluginDescriptor );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.plugin.plugin;
|
||||||
import org.apache.maven.tools.plugin.generator.BeanGenerator;
|
import org.apache.maven.tools.plugin.generator.BeanGenerator;
|
||||||
import org.apache.maven.tools.plugin.generator.Generator;
|
import org.apache.maven.tools.plugin.generator.Generator;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -31,9 +33,9 @@ public class BeanGeneratorMojo
|
||||||
* @parameter expression="${project.build.directory}/generated-sources"
|
* @parameter expression="${project.build.directory}/generated-sources"
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
protected String outputDirectory;
|
protected File outputDirectory;
|
||||||
|
|
||||||
protected String getOutputDirectory()
|
protected File getOutputDirectory()
|
||||||
{
|
{
|
||||||
return outputDirectory;
|
return outputDirectory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.plugin.plugin;
|
||||||
import org.apache.maven.tools.plugin.generator.Generator;
|
import org.apache.maven.tools.plugin.generator.Generator;
|
||||||
import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
|
import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a plugin descriptor.
|
* Generate a plugin descriptor.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -36,9 +38,9 @@ public class DescriptorGeneratorMojo
|
||||||
* @parameter expression="${project.build.outputDirectory}/META-INF/maven"
|
* @parameter expression="${project.build.outputDirectory}/META-INF/maven"
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
protected String outputDirectory;
|
protected File outputDirectory;
|
||||||
|
|
||||||
protected String getOutputDirectory()
|
protected File getOutputDirectory()
|
||||||
{
|
{
|
||||||
return outputDirectory;
|
return outputDirectory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.plugin.plugin;
|
||||||
import org.apache.maven.tools.plugin.generator.Generator;
|
import org.apache.maven.tools.plugin.generator.Generator;
|
||||||
import org.apache.maven.tools.plugin.generator.jelly.JellyHarnessGenerator;
|
import org.apache.maven.tools.plugin.generator.jelly.JellyHarnessGenerator;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -31,9 +33,9 @@ public class JellyGeneratorMojo
|
||||||
* @parameter expression="${project.build.directory}/generated-sources"
|
* @parameter expression="${project.build.directory}/generated-sources"
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
protected String outputDirectory;
|
protected File outputDirectory;
|
||||||
|
|
||||||
protected String getOutputDirectory()
|
protected File getOutputDirectory()
|
||||||
{
|
{
|
||||||
return outputDirectory;
|
return outputDirectory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.apache.maven.plugin.plugin;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2005 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.tools.plugin.generator.Generator;
|
||||||
|
import org.apache.maven.tools.plugin.generator.PluginXdocGenerator;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||||
|
* @version $Id$
|
||||||
|
* @goal xdoc
|
||||||
|
*/
|
||||||
|
public class XdocGeneratorMojo
|
||||||
|
extends AbstractGeneratorMojo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @parameter expression="${project.build.directory}/generated-xdocs"
|
||||||
|
* @required
|
||||||
|
*/
|
||||||
|
protected File outputDirectory;
|
||||||
|
|
||||||
|
protected File getOutputDirectory()
|
||||||
|
{
|
||||||
|
return outputDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Generator createGenerator()
|
||||||
|
{
|
||||||
|
return new PluginXdocGenerator();
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,7 +43,6 @@ public class MojoDefinitionTagLibrary
|
||||||
registerTag( "expression", ParamExpressionTag.class );
|
registerTag( "expression", ParamExpressionTag.class );
|
||||||
registerTag( "type", ParamTypeTag.class );
|
registerTag( "type", ParamTypeTag.class );
|
||||||
registerTag( "default", ParamDefaultTag.class );
|
registerTag( "default", ParamDefaultTag.class );
|
||||||
registerTag( "validator", ParamValidatorTag.class );
|
|
||||||
registerTag( "required", ParamRequiredTag.class );
|
registerTag( "required", ParamRequiredTag.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
package org.apache.maven.script.marmalade.tags;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author jdcasey
|
|
||||||
*/
|
|
||||||
public class ParamValidatorTag
|
|
||||||
extends AbstractStringValuedBodyTag
|
|
||||||
{
|
|
||||||
|
|
||||||
protected void setValue( String value ) throws MarmaladeExecutionException
|
|
||||||
{
|
|
||||||
ParameterTag parent = (ParameterTag) requireParent( ParameterTag.class );
|
|
||||||
parent.setValidator( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -37,10 +37,6 @@ public class ParameterTag
|
||||||
|
|
||||||
private String expression;
|
private String expression;
|
||||||
|
|
||||||
private String validator;
|
|
||||||
|
|
||||||
private String defaultVal;
|
|
||||||
|
|
||||||
private String deprecated;
|
private String deprecated;
|
||||||
|
|
||||||
private boolean required = true;
|
private boolean required = true;
|
||||||
|
@ -61,12 +57,10 @@ public class ParameterTag
|
||||||
Parameter param = new Parameter();
|
Parameter param = new Parameter();
|
||||||
|
|
||||||
param.setName( name );
|
param.setName( name );
|
||||||
param.setDefaultValue( defaultVal );
|
|
||||||
param.setDescription( description );
|
param.setDescription( description );
|
||||||
param.setExpression( expression );
|
param.setExpression( expression );
|
||||||
param.setRequired( required );
|
param.setRequired( required );
|
||||||
param.setType( type );
|
param.setType( type );
|
||||||
param.setValidator( validator );
|
|
||||||
param.setDeprecated( deprecated );
|
param.setDeprecated( deprecated );
|
||||||
|
|
||||||
return param;
|
return param;
|
||||||
|
@ -92,14 +86,8 @@ public class ParameterTag
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidator( String validator )
|
|
||||||
{
|
|
||||||
this.validator = validator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefault( String defaultVal )
|
public void setDefault( String defaultVal )
|
||||||
{
|
{
|
||||||
this.defaultVal = defaultVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequired( boolean required )
|
public void setRequired( boolean required )
|
||||||
|
|
Loading…
Reference in New Issue