o fixed checkstyle + updated javadoc
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@684236 13f79535-47bb-0310-9956-ffa450edef68master
parent
fa601065d6
commit
4c3d449369
|
|
@ -72,6 +72,11 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
return mojoDescriptors;
|
return mojoDescriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scriptFilesKeyedByBasedir not null
|
||||||
|
* @param outputDirectory not null
|
||||||
|
* @throws ExtractionException if any
|
||||||
|
*/
|
||||||
protected void copyScriptsToOutputDirectory( Map scriptFilesKeyedByBasedir, String outputDirectory )
|
protected void copyScriptsToOutputDirectory( Map scriptFilesKeyedByBasedir, String outputDirectory )
|
||||||
throws ExtractionException
|
throws ExtractionException
|
||||||
{
|
{
|
||||||
|
|
@ -121,6 +126,12 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param basedir not null
|
||||||
|
* @param directories not null
|
||||||
|
* @param scriptFileExtension not null
|
||||||
|
* @return map with subdirs paths as key
|
||||||
|
*/
|
||||||
protected Map gatherFilesByBasedir( File basedir, List directories, String scriptFileExtension )
|
protected Map gatherFilesByBasedir( File basedir, List directories, String scriptFileExtension )
|
||||||
{
|
{
|
||||||
Map sourcesByBasedir = new TreeMap();
|
Map sourcesByBasedir = new TreeMap();
|
||||||
|
|
@ -164,6 +175,15 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
return sourcesByBasedir;
|
return sourcesByBasedir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be implemented in the sub classes.
|
||||||
|
*
|
||||||
|
* @param metadataFilesKeyedByBasedir could be null
|
||||||
|
* @param pluginDescriptor could be null
|
||||||
|
* @return always null
|
||||||
|
* @throws ExtractionException if any
|
||||||
|
* @throws InvalidPluginDescriptorException if any
|
||||||
|
*/
|
||||||
protected List extractMojoDescriptorsFromMetadata( Map metadataFilesKeyedByBasedir,
|
protected List extractMojoDescriptorsFromMetadata( Map metadataFilesKeyedByBasedir,
|
||||||
PluginDescriptor pluginDescriptor )
|
PluginDescriptor pluginDescriptor )
|
||||||
throws ExtractionException, InvalidPluginDescriptorException
|
throws ExtractionException, InvalidPluginDescriptorException
|
||||||
|
|
@ -171,17 +191,34 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be implemented in the sub classes.
|
||||||
|
*
|
||||||
|
* @return always null
|
||||||
|
*/
|
||||||
protected String getMetadataFileExtension()
|
protected String getMetadataFileExtension()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be implemented in the sub classes.
|
||||||
|
*
|
||||||
|
* @param scriptFilesKeyedByBasedir could be null
|
||||||
|
* @param pluginDescriptor could be null
|
||||||
|
* @return always null
|
||||||
|
* @throws ExtractionException if any
|
||||||
|
* @throws InvalidPluginDescriptorException if any
|
||||||
|
*/
|
||||||
protected List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
|
protected List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
|
||||||
throws ExtractionException, InvalidPluginDescriptorException
|
throws ExtractionException, InvalidPluginDescriptorException
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the file extension like <code>.bsh</code> for BeanShell.
|
||||||
|
*/
|
||||||
protected abstract String getScriptFileExtension();
|
protected abstract String getScriptFileExtension();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -73,19 +73,19 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
w.startElement( "plugin" );
|
w.startElement( "plugin" );
|
||||||
|
|
||||||
element( w, "description", pluginDescriptor.getDescription() );
|
PluginUtils.element( w, "description", pluginDescriptor.getDescription() );
|
||||||
|
|
||||||
element( w, "groupId", pluginDescriptor.getGroupId() );
|
PluginUtils.element( w, "groupId", pluginDescriptor.getGroupId() );
|
||||||
|
|
||||||
element( w, "artifactId", pluginDescriptor.getArtifactId() );
|
PluginUtils.element( w, "artifactId", pluginDescriptor.getArtifactId() );
|
||||||
|
|
||||||
element( w, "version", pluginDescriptor.getVersion() );
|
PluginUtils.element( w, "version", pluginDescriptor.getVersion() );
|
||||||
|
|
||||||
element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );
|
PluginUtils.element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );
|
||||||
|
|
||||||
element( w, "isolatedRealm", "" + pluginDescriptor.isIsolatedRealm() );
|
PluginUtils.element( w, "isolatedRealm", "" + pluginDescriptor.isIsolatedRealm() );
|
||||||
|
|
||||||
element( w, "inheritedByDefault", "" + pluginDescriptor.isInheritedByDefault() );
|
PluginUtils.element( w, "inheritedByDefault", "" + pluginDescriptor.isInheritedByDefault() );
|
||||||
|
|
||||||
w.startElement( "mojos" );
|
w.startElement( "mojos" );
|
||||||
|
|
||||||
|
|
@ -112,6 +112,10 @@ public class PluginDescriptorGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w )
|
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w )
|
||||||
{
|
{
|
||||||
w.startElement( "mojo" );
|
w.startElement( "mojo" );
|
||||||
|
|
@ -121,9 +125,7 @@ public class PluginDescriptorGenerator
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
w.startElement( "goal" );
|
w.startElement( "goal" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getGoal() );
|
w.writeText( mojoDescriptor.getGoal() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -135,9 +137,7 @@ public class PluginDescriptorGenerator
|
||||||
if ( description != null )
|
if ( description != null )
|
||||||
{
|
{
|
||||||
w.startElement( "description" );
|
w.startElement( "description" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getDescription() );
|
w.writeText( mojoDescriptor.getDescription() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,44 +147,44 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
if ( mojoDescriptor.isDependencyResolutionRequired() != null )
|
if ( mojoDescriptor.isDependencyResolutionRequired() != null )
|
||||||
{
|
{
|
||||||
element( w, "requiresDependencyResolution", mojoDescriptor.isDependencyResolutionRequired() );
|
PluginUtils.element( w, "requiresDependencyResolution", mojoDescriptor.isDependencyResolutionRequired() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "requiresDirectInvocation", "" + mojoDescriptor.isDirectInvocationOnly() );
|
PluginUtils.element( w, "requiresDirectInvocation", "" + mojoDescriptor.isDirectInvocationOnly() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "requiresProject", "" + mojoDescriptor.isProjectRequired() );
|
PluginUtils.element( w, "requiresProject", "" + mojoDescriptor.isProjectRequired() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "requiresReports", "" + mojoDescriptor.isRequiresReports() );
|
PluginUtils.element( w, "requiresReports", "" + mojoDescriptor.isRequiresReports() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "aggregator", "" + mojoDescriptor.isAggregator() );
|
PluginUtils.element( w, "aggregator", "" + mojoDescriptor.isAggregator() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "requiresOnline", "" + mojoDescriptor.isOnlineRequired() );
|
PluginUtils.element( w, "requiresOnline", "" + mojoDescriptor.isOnlineRequired() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "inheritedByDefault", "" + mojoDescriptor.isInheritedByDefault() );
|
PluginUtils.element( w, "inheritedByDefault", "" + mojoDescriptor.isInheritedByDefault() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
@ -192,7 +192,7 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
if ( mojoDescriptor.getPhase() != null )
|
if ( mojoDescriptor.getPhase() != null )
|
||||||
{
|
{
|
||||||
element( w, "phase", mojoDescriptor.getPhase() );
|
PluginUtils.element( w, "phase", mojoDescriptor.getPhase() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -201,17 +201,17 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
if ( mojoDescriptor.getExecutePhase() != null )
|
if ( mojoDescriptor.getExecutePhase() != null )
|
||||||
{
|
{
|
||||||
element( w, "executePhase", mojoDescriptor.getExecutePhase() );
|
PluginUtils.element( w, "executePhase", mojoDescriptor.getExecutePhase() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mojoDescriptor.getExecuteGoal() != null )
|
if ( mojoDescriptor.getExecuteGoal() != null )
|
||||||
{
|
{
|
||||||
element( w, "executeGoal", mojoDescriptor.getExecuteGoal() );
|
PluginUtils.element( w, "executeGoal", mojoDescriptor.getExecuteGoal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mojoDescriptor.getExecuteLifecycle() != null )
|
if ( mojoDescriptor.getExecuteLifecycle() != null )
|
||||||
{
|
{
|
||||||
element( w, "executeLifecycle", mojoDescriptor.getExecuteLifecycle() );
|
PluginUtils.element( w, "executeLifecycle", mojoDescriptor.getExecuteLifecycle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -219,9 +219,7 @@ public class PluginDescriptorGenerator
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
w.startElement( "implementation" );
|
w.startElement( "implementation" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getImplementation() );
|
w.writeText( mojoDescriptor.getImplementation() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -229,9 +227,7 @@ public class PluginDescriptorGenerator
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
w.startElement( "language" );
|
w.startElement( "language" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getLanguage() );
|
w.writeText( mojoDescriptor.getLanguage() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -241,9 +237,7 @@ public class PluginDescriptorGenerator
|
||||||
if ( mojoDescriptor.getComponentConfigurator() != null )
|
if ( mojoDescriptor.getComponentConfigurator() != null )
|
||||||
{
|
{
|
||||||
w.startElement( "configurator" );
|
w.startElement( "configurator" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getComponentConfigurator() );
|
w.writeText( mojoDescriptor.getComponentConfigurator() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,9 +248,7 @@ public class PluginDescriptorGenerator
|
||||||
if ( mojoDescriptor.getComponentComposer() != null )
|
if ( mojoDescriptor.getComponentComposer() != null )
|
||||||
{
|
{
|
||||||
w.startElement( "composer" );
|
w.startElement( "composer" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getComponentComposer() );
|
w.writeText( mojoDescriptor.getComponentComposer() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,9 +257,7 @@ public class PluginDescriptorGenerator
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
w.startElement( "instantiationStrategy" );
|
w.startElement( "instantiationStrategy" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getInstantiationStrategy() );
|
w.writeText( mojoDescriptor.getInstantiationStrategy() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -275,9 +265,7 @@ public class PluginDescriptorGenerator
|
||||||
// the calculated (decorated, resolved) execution stack
|
// the calculated (decorated, resolved) execution stack
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
w.startElement( "executionStrategy" );
|
w.startElement( "executionStrategy" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getExecutionStrategy() );
|
w.writeText( mojoDescriptor.getExecutionStrategy() );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -329,9 +317,8 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
String roleHint = null;
|
String roleHint = null;
|
||||||
|
|
||||||
int posRoleHintSeparator;
|
int posRoleHintSeparator = role.indexOf( "#" );
|
||||||
|
if ( posRoleHintSeparator > 0 )
|
||||||
if ( ( posRoleHintSeparator = role.indexOf( "#" ) ) > 0 )
|
|
||||||
{
|
{
|
||||||
roleHint = role.substring( posRoleHintSeparator + 1 );
|
roleHint = role.substring( posRoleHintSeparator + 1 );
|
||||||
|
|
||||||
|
|
@ -351,33 +338,33 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
w.startElement( "parameter" );
|
w.startElement( "parameter" );
|
||||||
|
|
||||||
element( w, "name", parameter.getName() );
|
PluginUtils.element( w, "name", parameter.getName() );
|
||||||
|
|
||||||
if ( parameter.getAlias() != null )
|
if ( parameter.getAlias() != null )
|
||||||
{
|
{
|
||||||
element( w, "alias", parameter.getAlias() );
|
PluginUtils.element( w, "alias", parameter.getAlias() );
|
||||||
}
|
}
|
||||||
|
|
||||||
element( w, "type", parameter.getType() );
|
PluginUtils.element( w, "type", parameter.getType() );
|
||||||
|
|
||||||
if ( parameter.getDeprecated() != null )
|
if ( parameter.getDeprecated() != null )
|
||||||
{
|
{
|
||||||
element( w, "deprecated", parameter.getDeprecated() );
|
PluginUtils.element( w, "deprecated", parameter.getDeprecated() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parameter.getImplementation() != null )
|
if ( parameter.getImplementation() != null )
|
||||||
{
|
{
|
||||||
element( w, "implementation", parameter.getImplementation() );
|
PluginUtils.element( w, "implementation", parameter.getImplementation() );
|
||||||
}
|
}
|
||||||
|
|
||||||
element( w, "required", Boolean.toString( parameter.isRequired() ) );
|
PluginUtils.element( w, "required", Boolean.toString( parameter.isRequired() ) );
|
||||||
|
|
||||||
element( w, "editable", Boolean.toString( parameter.isEditable() ) );
|
PluginUtils.element( w, "editable", Boolean.toString( parameter.isEditable() ) );
|
||||||
|
|
||||||
element( w, "description", parameter.getDescription() );
|
PluginUtils.element( w, "description", parameter.getDescription() );
|
||||||
|
|
||||||
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) ||
|
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() )
|
||||||
StringUtils.isNotEmpty( parameter.getExpression() ) )
|
|| StringUtils.isNotEmpty( parameter.getExpression() ) )
|
||||||
{
|
{
|
||||||
configuration.add( parameter );
|
configuration.add( parameter );
|
||||||
}
|
}
|
||||||
|
|
@ -391,7 +378,7 @@ public class PluginDescriptorGenerator
|
||||||
w.endElement();
|
w.endElement();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Coinfiguration
|
// Configuration
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
if ( !configuration.isEmpty() )
|
if ( !configuration.isEmpty() )
|
||||||
|
|
@ -441,14 +428,14 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
w.startElement( "requirement" );
|
w.startElement( "requirement" );
|
||||||
|
|
||||||
element( w, "role", requirement.getRole() );
|
PluginUtils.element( w, "role", requirement.getRole() );
|
||||||
|
|
||||||
if ( requirement.getRoleHint() != null )
|
if ( requirement.getRoleHint() != null )
|
||||||
{
|
{
|
||||||
element( w, "role-hint", requirement.getRoleHint() );
|
PluginUtils.element( w, "role-hint", requirement.getRoleHint() );
|
||||||
}
|
}
|
||||||
|
|
||||||
element( w, "field-name", key );
|
PluginUtils.element( w, "field-name", key );
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
@ -456,15 +443,6 @@ public class PluginDescriptorGenerator
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void element( XMLWriter w, String name, String value )
|
|
||||||
{
|
|
||||||
PluginUtils.element( w, name, value );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,13 @@ public class PluginHelpGenerator
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements Generator
|
implements Generator
|
||||||
{
|
{
|
||||||
|
/** Line separator */
|
||||||
private static final String LS = System.getProperty( "line.separator" );
|
private static final String LS = System.getProperty( "line.separator" );
|
||||||
|
|
||||||
|
/** Default generated class name */
|
||||||
private static final String HELP_MOJO_CLASS_NAME = "HelpMojo";
|
private static final String HELP_MOJO_CLASS_NAME = "HelpMojo";
|
||||||
|
|
||||||
|
/** Default goal */
|
||||||
private static final String HELP_GOAL = "help";
|
private static final String HELP_GOAL = "help";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -155,7 +158,6 @@ public class PluginHelpGenerator
|
||||||
+ " -Ddetail=true -Dgoal=<goal-name></pre> to display parameter details." );
|
+ " -Ddetail=true -Dgoal=<goal-name></pre> to display parameter details." );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
|
||||||
{
|
{
|
||||||
Parameter param = new Parameter();
|
Parameter param = new Parameter();
|
||||||
param.setName( "detail" );
|
param.setName( "detail" );
|
||||||
|
|
@ -164,27 +166,24 @@ public class PluginHelpGenerator
|
||||||
param.setDefaultValue( "false" );
|
param.setDefaultValue( "false" );
|
||||||
param.setExpression( "${detail}" );
|
param.setExpression( "${detail}" );
|
||||||
descriptor.addParameter( param );
|
descriptor.addParameter( param );
|
||||||
}
|
|
||||||
{
|
param = new Parameter();
|
||||||
Parameter param = new Parameter();
|
|
||||||
param.setName( "goal" );
|
param.setName( "goal" );
|
||||||
param.setType( "java.lang.String" );
|
param.setType( "java.lang.String" );
|
||||||
param.setDescription( "The name of the goal for which to show help."
|
param.setDescription( "The name of the goal for which to show help."
|
||||||
+ " If unspecified, all goals will be displayed." );
|
+ " If unspecified, all goals will be displayed." );
|
||||||
param.setExpression( "${goal}" );
|
param.setExpression( "${goal}" );
|
||||||
descriptor.addParameter( param );
|
descriptor.addParameter( param );
|
||||||
}
|
|
||||||
{
|
param = new Parameter();
|
||||||
Parameter param = new Parameter();
|
|
||||||
param.setName( "lineLength" );
|
param.setName( "lineLength" );
|
||||||
param.setType( "int" );
|
param.setType( "int" );
|
||||||
param.setDescription( "The maximum length of a display line, should be positive." );
|
param.setDescription( "The maximum length of a display line, should be positive." );
|
||||||
param.setDefaultValue( "80" );
|
param.setDefaultValue( "80" );
|
||||||
param.setExpression( "${lineLength}" );
|
param.setExpression( "${lineLength}" );
|
||||||
descriptor.addParameter( param );
|
descriptor.addParameter( param );
|
||||||
}
|
|
||||||
{
|
param = new Parameter();
|
||||||
Parameter param = new Parameter();
|
|
||||||
param.setName( "indentSize" );
|
param.setName( "indentSize" );
|
||||||
param.setType( "int" );
|
param.setType( "int" );
|
||||||
param.setDescription( "The number of spaces per indentation level, should be positive." );
|
param.setDescription( "The number of spaces per indentation level, should be positive." );
|
||||||
|
|
@ -192,7 +191,6 @@ public class PluginHelpGenerator
|
||||||
param.setExpression( "${indentSize}" );
|
param.setExpression( "${indentSize}" );
|
||||||
descriptor.addParameter( param );
|
descriptor.addParameter( param );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
throw new RuntimeException( "Failed to setup parameters for help goal", e );
|
throw new RuntimeException( "Failed to setup parameters for help goal", e );
|
||||||
|
|
@ -204,7 +202,7 @@ public class PluginHelpGenerator
|
||||||
/**
|
/**
|
||||||
* Find the best package name, based on the number of hits of actual Mojo classes.
|
* Find the best package name, based on the number of hits of actual Mojo classes.
|
||||||
*
|
*
|
||||||
* @param pluginDescriptor
|
* @param pluginDescriptor not null
|
||||||
* @return the best name of the package for the generated mojo
|
* @return the best name of the package for the generated mojo
|
||||||
*/
|
*/
|
||||||
private static String discoverPackageName( PluginDescriptor pluginDescriptor )
|
private static String discoverPackageName( PluginDescriptor pluginDescriptor )
|
||||||
|
|
@ -253,9 +251,9 @@ public class PluginHelpGenerator
|
||||||
/**
|
/**
|
||||||
* Generates the <code>HelpMojo</code> class.
|
* Generates the <code>HelpMojo</code> class.
|
||||||
*
|
*
|
||||||
* @param writer
|
* @param writer not null
|
||||||
* @param pluginDescriptor
|
* @param pluginDescriptor not null
|
||||||
* @param helpDescriptor
|
* @param helpDescriptor not null
|
||||||
* @throws IOException if any
|
* @throws IOException if any
|
||||||
*/
|
*/
|
||||||
private static void writeClass( Writer writer, PluginDescriptor pluginDescriptor, MojoDescriptor helpDescriptor )
|
private static void writeClass( Writer writer, PluginDescriptor pluginDescriptor, MojoDescriptor helpDescriptor )
|
||||||
|
|
@ -296,6 +294,10 @@ public class PluginHelpGenerator
|
||||||
writer.write( "}" + LS );
|
writer.write( "}" + LS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeImports( Writer writer )
|
private static void writeImports( Writer writer )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -307,6 +309,12 @@ public class PluginHelpGenerator
|
||||||
writer.write( "import org.apache.maven.plugin.MojoExecutionException;" + LS );
|
writer.write( "import org.apache.maven.plugin.MojoExecutionException;" + LS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @param pluginDescriptor not null
|
||||||
|
* @param helpDescriptor not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeMojoJavadoc( Writer writer, PluginDescriptor pluginDescriptor,
|
private static void writeMojoJavadoc( Writer writer, PluginDescriptor pluginDescriptor,
|
||||||
MojoDescriptor helpDescriptor )
|
MojoDescriptor helpDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
|
|
@ -342,6 +350,11 @@ public class PluginHelpGenerator
|
||||||
writer.write( " */" + LS );
|
writer.write( " */" + LS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @param helpDescriptor not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeVariables( Writer writer, MojoDescriptor helpDescriptor )
|
private static void writeVariables( Writer writer, MojoDescriptor helpDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -371,6 +384,12 @@ public class PluginHelpGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @param pluginDescriptor not null
|
||||||
|
* @param helpDescriptor not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeExecute( Writer writer, PluginDescriptor pluginDescriptor, MojoDescriptor helpDescriptor )
|
private static void writeExecute( Writer writer, PluginDescriptor pluginDescriptor, MojoDescriptor helpDescriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -396,12 +415,14 @@ public class PluginHelpGenerator
|
||||||
|
|
||||||
writer.write( " if ( lineLength <= 0 )" + LS );
|
writer.write( " if ( lineLength <= 0 )" + LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " getLog().warn( \"The parameter 'lineLength' should be positive, using '80' as default.\" );" + LS );
|
writer.write( " getLog().warn( \"The parameter 'lineLength' should be positive, using '80' as "
|
||||||
|
+ "default.\" );" + LS );
|
||||||
writer.write( " lineLength = 80;" + LS );
|
writer.write( " lineLength = 80;" + LS );
|
||||||
writer.write( " }" + LS );
|
writer.write( " }" + LS );
|
||||||
writer.write( " if ( indentSize <= 0 )" + LS );
|
writer.write( " if ( indentSize <= 0 )" + LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " getLog().warn( \"The parameter 'indentSize' should be positive, using '2' as default.\" );" + LS );
|
writer.write( " getLog().warn( \"The parameter 'indentSize' should be positive, using '2' as "
|
||||||
|
+ "default.\" );" + LS );
|
||||||
writer.write( " indentSize = 2;" + LS );
|
writer.write( " indentSize = 2;" + LS );
|
||||||
writer.write( " }" + LS );
|
writer.write( " }" + LS );
|
||||||
writer.write( LS );
|
writer.write( LS );
|
||||||
|
|
@ -416,7 +437,8 @@ public class PluginHelpGenerator
|
||||||
writer.write( " append( sb, \""
|
writer.write( " append( sb, \""
|
||||||
+ StringUtils.escape( pluginDescriptor.getName() + " " + pluginDescriptor.getVersion() )
|
+ StringUtils.escape( pluginDescriptor.getName() + " " + pluginDescriptor.getVersion() )
|
||||||
+ "\", 0 );" + LS );
|
+ "\", 0 );" + LS );
|
||||||
writer.write( " append( sb, \"" + toDescription( pluginDescriptor.getDescription() ) + "\", 1 );" + LS );
|
writer.write( " append( sb, \"" + toDescription( pluginDescriptor.getDescription() ) + "\", 1 );"
|
||||||
|
+ LS );
|
||||||
writer.write( " append( sb, \"\", 0 );" + LS );
|
writer.write( " append( sb, \"\", 0 );" + LS );
|
||||||
writer.write( LS );
|
writer.write( LS );
|
||||||
|
|
||||||
|
|
@ -443,6 +465,11 @@ public class PluginHelpGenerator
|
||||||
writer.write( " }" + LS );
|
writer.write( " }" + LS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @param descriptor not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeGoal( Writer writer, MojoDescriptor descriptor )
|
private static void writeGoal( Writer writer, MojoDescriptor descriptor )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -495,6 +522,11 @@ public class PluginHelpGenerator
|
||||||
writer.write( LS );
|
writer.write( LS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @param parameter not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeParameter( Writer writer, Parameter parameter )
|
private static void writeParameter( Writer writer, Parameter parameter )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -520,6 +552,10 @@ public class PluginHelpGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param writer not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
private static void writeUtilities( Writer writer )
|
private static void writeUtilities( Writer writer )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -546,7 +582,8 @@ public class PluginHelpGenerator
|
||||||
|
|
||||||
writer.write( LS );
|
writer.write( LS );
|
||||||
writer.write( " /** " + LS );
|
writer.write( " /** " + LS );
|
||||||
writer.write( " * Append a description to the buffer by respecting the indentSize and lineLength parameters." + LS );
|
writer.write( " * Append a description to the buffer by respecting the indentSize and lineLength "
|
||||||
|
+ "parameters." + LS );
|
||||||
writer.write( " * <b>Note</b>: The last character is always a new line." + LS );
|
writer.write( " * <b>Note</b>: The last character is always a new line." + LS );
|
||||||
writer.write( " * " + LS );
|
writer.write( " * " + LS );
|
||||||
writer.write( " * @param sb The buffer to append the description, not <code>null</code>." + LS );
|
writer.write( " * @param sb The buffer to append the description, not <code>null</code>." + LS );
|
||||||
|
|
@ -555,7 +592,8 @@ public class PluginHelpGenerator
|
||||||
writer.write( " */" + LS );
|
writer.write( " */" + LS );
|
||||||
writer.write( " private void append( StringBuffer sb, String description, int indent )" + LS );
|
writer.write( " private void append( StringBuffer sb, String description, int indent )" + LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); )" + LS );
|
writer.write( " for ( Iterator it = toLines( description, indent, indentSize, lineLength )"
|
||||||
|
+ ".iterator(); it.hasNext(); )" + LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " sb.append( it.next().toString() ).append( '\\n' );" + LS );
|
writer.write( " sb.append( it.next().toString() ).append( '\\n' );" + LS );
|
||||||
writer.write( " }" + LS );
|
writer.write( " }" + LS );
|
||||||
|
|
@ -572,7 +610,8 @@ public class PluginHelpGenerator
|
||||||
writer.write( " * @return The sequence of display lines, never <code>null</code>." + LS );
|
writer.write( " * @return The sequence of display lines, never <code>null</code>." + LS );
|
||||||
writer.write( " * @throws NegativeArraySizeException if <code>indent < 0</code>" + LS );
|
writer.write( " * @throws NegativeArraySizeException if <code>indent < 0</code>" + LS );
|
||||||
writer.write( " */" + LS );
|
writer.write( " */" + LS );
|
||||||
writer.write( " private static List toLines( String text, int indent, int indentSize, int lineLength )" + LS );
|
writer.write( " private static List toLines( String text, int indent, int indentSize, int lineLength )"
|
||||||
|
+ LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " List lines = new ArrayList();" + LS );
|
writer.write( " List lines = new ArrayList();" + LS );
|
||||||
writer.write( LS );
|
writer.write( LS );
|
||||||
|
|
@ -588,14 +627,16 @@ public class PluginHelpGenerator
|
||||||
|
|
||||||
writer.write( LS );
|
writer.write( LS );
|
||||||
writer.write( " /** " + LS );
|
writer.write( " /** " + LS );
|
||||||
writer.write( " * Adds the specified line to the output sequence, performing line wrapping if necessary." + LS );
|
writer.write( " * Adds the specified line to the output sequence, performing line wrapping if necessary."
|
||||||
|
+ LS );
|
||||||
writer.write( " * " + LS );
|
writer.write( " * " + LS );
|
||||||
writer.write( " * @param lines The sequence of display lines, must not be <code>null</code>." + LS );
|
writer.write( " * @param lines The sequence of display lines, must not be <code>null</code>." + LS );
|
||||||
writer.write( " * @param line The line to add, must not be <code>null</code>." + LS );
|
writer.write( " * @param line The line to add, must not be <code>null</code>." + LS );
|
||||||
writer.write( " * @param indentSize The size of each indentation, must not be negative." + LS );
|
writer.write( " * @param indentSize The size of each indentation, must not be negative." + LS );
|
||||||
writer.write( " * @param lineLength The length of the line, must not be negative." + LS );
|
writer.write( " * @param lineLength The length of the line, must not be negative." + LS );
|
||||||
writer.write( " */" + LS );
|
writer.write( " */" + LS );
|
||||||
writer.write( " private static void toLines( List lines, String line, int indentSize, int lineLength )" + LS );
|
writer.write( " private static void toLines( List lines, String line, int indentSize, int lineLength )"
|
||||||
|
+ LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " int lineIndent = getIndentLevel( line );" + LS );
|
writer.write( " int lineIndent = getIndentLevel( line );" + LS );
|
||||||
writer.write( " StringBuffer buf = new StringBuffer( 256 );" + LS );
|
writer.write( " StringBuffer buf = new StringBuffer( 256 );" + LS );
|
||||||
|
|
@ -621,7 +662,8 @@ public class PluginHelpGenerator
|
||||||
writer.write( " char c = token.charAt( j );" + LS );
|
writer.write( " char c = token.charAt( j );" + LS );
|
||||||
writer.write( " if ( c == '\\t' )" + LS );
|
writer.write( " if ( c == '\\t' )" + LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
writer.write( " buf.append( repeat( \" \", indentSize - buf.length() % indentSize ) );" + LS );
|
writer.write( " buf.append( repeat( \" \", indentSize - buf.length() % indentSize ) );"
|
||||||
|
+ LS );
|
||||||
writer.write( " }" + LS );
|
writer.write( " }" + LS );
|
||||||
writer.write( " else if ( c == '\\u00A0' )" + LS );
|
writer.write( " else if ( c == '\\u00A0' )" + LS );
|
||||||
writer.write( " {" + LS );
|
writer.write( " {" + LS );
|
||||||
|
|
@ -640,7 +682,8 @@ public class PluginHelpGenerator
|
||||||
writer.write( " /** " + LS );
|
writer.write( " /** " + LS );
|
||||||
writer.write( " * Gets the indentation level of the specified line." + LS );
|
writer.write( " * Gets the indentation level of the specified line." + LS );
|
||||||
writer.write( " * " + LS );
|
writer.write( " * " + LS );
|
||||||
writer.write( " * @param line The line whose indentation level should be retrieved, must not be <code>null</code>." + LS );
|
writer.write( " * @param line The line whose indentation level should be retrieved, must not be "
|
||||||
|
+ "<code>null</code>." + LS );
|
||||||
writer.write( " * @return The indentation level of the line." + LS );
|
writer.write( " * @return The indentation level of the line." + LS );
|
||||||
writer.write( " */" + LS );
|
writer.write( " */" + LS );
|
||||||
writer.write( " private static int getIndentLevel( String line )" + LS );
|
writer.write( " private static int getIndentLevel( String line )" + LS );
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,10 @@ import org.codehaus.plexus.util.xml.XMLWriter;
|
||||||
public class PluginXdocGenerator
|
public class PluginXdocGenerator
|
||||||
implements Generator
|
implements Generator
|
||||||
{
|
{
|
||||||
|
/** locale */
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
|
|
||||||
|
/** project */
|
||||||
private final MavenProject project;
|
private final MavenProject project;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,6 +77,7 @@ public class PluginXdocGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param project not null.
|
||||||
* @param locale not null wanted locale.
|
* @param locale not null wanted locale.
|
||||||
*/
|
*/
|
||||||
public PluginXdocGenerator( MavenProject project, Locale locale )
|
public PluginXdocGenerator( MavenProject project, Locale locale )
|
||||||
|
|
@ -99,11 +102,17 @@ public class PluginXdocGenerator
|
||||||
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();
|
||||||
|
|
||||||
processMojoDescriptor( descriptor, destinationDirectory );
|
processMojoDescriptor( descriptor, destinationDirectory );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param destinationDirectory not null
|
||||||
|
* @throws IOException if any
|
||||||
|
*/
|
||||||
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory )
|
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
@ -125,11 +134,20 @@ public class PluginXdocGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojo not null
|
||||||
|
* @param ext not null
|
||||||
|
* @return the output file name
|
||||||
|
*/
|
||||||
private String getMojoFilename( MojoDescriptor mojo, String ext )
|
private String getMojoFilename( MojoDescriptor mojo, String ext )
|
||||||
{
|
{
|
||||||
return mojo.getGoal() + "-mojo." + ext;
|
return mojo.getGoal() + "-mojo." + ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeBody( MojoDescriptor mojoDescriptor, XMLWriter w )
|
private void writeBody( MojoDescriptor mojoDescriptor, XMLWriter w )
|
||||||
{
|
{
|
||||||
w.startElement( "document" );
|
w.startElement( "document" );
|
||||||
|
|
@ -141,9 +159,7 @@ public class PluginXdocGenerator
|
||||||
w.startElement( "properties" );
|
w.startElement( "properties" );
|
||||||
|
|
||||||
w.startElement( "title" );
|
w.startElement( "title" );
|
||||||
|
|
||||||
w.writeText( mojoDescriptor.getFullGoalName() );
|
w.writeText( mojoDescriptor.getFullGoalName() );
|
||||||
|
|
||||||
w.endElement(); // title
|
w.endElement(); // title
|
||||||
|
|
||||||
w.endElement(); // properties
|
w.endElement(); // properties
|
||||||
|
|
@ -204,6 +220,10 @@ public class PluginXdocGenerator
|
||||||
w.endElement(); // document
|
w.endElement(); // document
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeReportNotice( MojoDescriptor mojoDescriptor, XMLWriter w )
|
private void writeReportNotice( MojoDescriptor mojoDescriptor, XMLWriter w )
|
||||||
{
|
{
|
||||||
if ( PluginUtils.isMavenReport( mojoDescriptor.getImplementation(), project ) )
|
if ( PluginUtils.isMavenReport( mojoDescriptor.getImplementation(), project ) )
|
||||||
|
|
@ -215,6 +235,10 @@ public class PluginXdocGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeGoalAttributes( MojoDescriptor mojoDescriptor, XMLWriter w )
|
private void writeGoalAttributes( MojoDescriptor mojoDescriptor, XMLWriter w )
|
||||||
{
|
{
|
||||||
w.startElement( "p" );
|
w.startElement( "p" );
|
||||||
|
|
@ -311,6 +335,10 @@ public class PluginXdocGenerator
|
||||||
w.endElement(); //ul
|
w.endElement(); //ul
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w )
|
private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w )
|
||||||
{
|
{
|
||||||
List parameterList = mojoDescriptor.getParameters();
|
List parameterList = mojoDescriptor.getParameters();
|
||||||
|
|
@ -337,6 +365,10 @@ public class PluginXdocGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parameterList not null
|
||||||
|
* @return the parameters list without components.
|
||||||
|
*/
|
||||||
private List filterParameters( List parameterList )
|
private List filterParameters( List parameterList )
|
||||||
{
|
{
|
||||||
List filtered = new ArrayList();
|
List filtered = new ArrayList();
|
||||||
|
|
@ -362,6 +394,11 @@ public class PluginXdocGenerator
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param parameterList not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeParameterDetails( MojoDescriptor mojoDescriptor, List parameterList, XMLWriter w )
|
private void writeParameterDetails( MojoDescriptor mojoDescriptor, List parameterList, XMLWriter w )
|
||||||
{
|
{
|
||||||
w.startElement( "subsection" );
|
w.startElement( "subsection" );
|
||||||
|
|
@ -406,17 +443,20 @@ public class PluginXdocGenerator
|
||||||
{
|
{
|
||||||
if ( StringUtils.isNotEmpty( mojoDescriptor.getSince() ) )
|
if ( StringUtils.isNotEmpty( mojoDescriptor.getSince() ) )
|
||||||
{
|
{
|
||||||
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.since" ), mojoDescriptor.getSince(), w );
|
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.since" ),
|
||||||
|
mojoDescriptor.getSince(), w );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parameter.isRequired() )
|
if ( parameter.isRequired() )
|
||||||
{
|
{
|
||||||
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.required" ), getString( "pluginxdoc.yes" ), w );
|
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.required" ),
|
||||||
|
getString( "pluginxdoc.yes" ), w );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.required" ), getString( "pluginxdoc.no" ), w );
|
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.required" ),
|
||||||
|
getString( "pluginxdoc.no" ), w );
|
||||||
}
|
}
|
||||||
|
|
||||||
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.expression" ), parameter.getExpression(), w );
|
writeDetail( getString( "pluginxdoc.mojodescriptor.parameter.expression" ), parameter.getExpression(), w );
|
||||||
|
|
@ -434,6 +474,11 @@ public class PluginXdocGenerator
|
||||||
w.endElement();
|
w.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param param not null
|
||||||
|
* @param value could be null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeDetail( String param, String value, XMLWriter w )
|
private void writeDetail( String param, String value, XMLWriter w )
|
||||||
{
|
{
|
||||||
if ( StringUtils.isNotEmpty( value ) )
|
if ( StringUtils.isNotEmpty( value ) )
|
||||||
|
|
@ -444,21 +489,34 @@ public class PluginXdocGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param parameterList not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeParameterSummary( MojoDescriptor mojoDescriptor, List parameterList, XMLWriter w )
|
private void writeParameterSummary( MojoDescriptor mojoDescriptor, List parameterList, XMLWriter w )
|
||||||
{
|
{
|
||||||
List requiredParams = getParametersByRequired( true, parameterList );
|
List requiredParams = getParametersByRequired( true, parameterList );
|
||||||
if ( requiredParams.size() > 0 )
|
if ( requiredParams.size() > 0 )
|
||||||
{
|
{
|
||||||
writeParameterList( mojoDescriptor, getString( "pluginxdoc.mojodescriptor.requiredParameters" ), requiredParams, w );
|
writeParameterList( mojoDescriptor, getString( "pluginxdoc.mojodescriptor.requiredParameters" ),
|
||||||
|
requiredParams, w );
|
||||||
}
|
}
|
||||||
|
|
||||||
List optionalParams = getParametersByRequired( false, parameterList );
|
List optionalParams = getParametersByRequired( false, parameterList );
|
||||||
if ( optionalParams.size() > 0 )
|
if ( optionalParams.size() > 0 )
|
||||||
{
|
{
|
||||||
writeParameterList( mojoDescriptor, getString( "pluginxdoc.mojodescriptor.optionalParameters" ), optionalParams, w );
|
writeParameterList( mojoDescriptor, getString( "pluginxdoc.mojodescriptor.optionalParameters" ),
|
||||||
|
optionalParams, w );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @param title not null
|
||||||
|
* @param parameterList not null
|
||||||
|
* @param w not null
|
||||||
|
*/
|
||||||
private void writeParameterList( MojoDescriptor mojoDescriptor, String title, List parameterList, XMLWriter w )
|
private void writeParameterList( MojoDescriptor mojoDescriptor, String title, List parameterList, XMLWriter w )
|
||||||
{
|
{
|
||||||
w.startElement( "subsection" );
|
w.startElement( "subsection" );
|
||||||
|
|
@ -532,7 +590,8 @@ public class PluginXdocGenerator
|
||||||
|
|
||||||
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) )
|
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) )
|
||||||
{
|
{
|
||||||
w.writeMarkup( format( "pluginxdoc.mojodescriptor.parameter.defaultValue", parameter.getDefaultValue() ) );
|
w.writeMarkup( format( "pluginxdoc.mojodescriptor.parameter.defaultValue",
|
||||||
|
parameter.getDefaultValue() ) );
|
||||||
}
|
}
|
||||||
w.endElement(); //td
|
w.endElement(); //td
|
||||||
w.endElement(); //tr
|
w.endElement(); //tr
|
||||||
|
|
@ -542,6 +601,11 @@ public class PluginXdocGenerator
|
||||||
w.endElement(); //section
|
w.endElement(); //section
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param required <code>true</code> for required parameters, <code>false</code> otherwise.
|
||||||
|
* @param parameterList not null
|
||||||
|
* @return list of parameters depending the value of <code>required</code>
|
||||||
|
*/
|
||||||
private List getParametersByRequired( boolean required, List parameterList )
|
private List getParametersByRequired( boolean required, List parameterList )
|
||||||
{
|
{
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@ public class DefaultMojoScanner
|
||||||
*/
|
*/
|
||||||
private Set/* <String> */activeExtractors;
|
private Set/* <String> */activeExtractors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor
|
||||||
|
*
|
||||||
|
* @param extractors not null
|
||||||
|
*/
|
||||||
public DefaultMojoScanner( Map extractors )
|
public DefaultMojoScanner( Map extractors )
|
||||||
{
|
{
|
||||||
this.mojoDescriptorExtractors = extractors;
|
this.mojoDescriptorExtractors = extractors;
|
||||||
|
|
@ -57,8 +62,12 @@ public class DefaultMojoScanner
|
||||||
this.enableLogging( new ConsoleLogger( Logger.LEVEL_INFO, "standalone-scanner-logger" ) );
|
this.enableLogging( new ConsoleLogger( Logger.LEVEL_INFO, "standalone-scanner-logger" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empty constructor
|
||||||
|
*/
|
||||||
public DefaultMojoScanner()
|
public DefaultMojoScanner()
|
||||||
{
|
{
|
||||||
|
// nop
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
|
@ -66,13 +75,13 @@ public class DefaultMojoScanner
|
||||||
throws ExtractionException, InvalidPluginDescriptorException
|
throws ExtractionException, InvalidPluginDescriptorException
|
||||||
{
|
{
|
||||||
Logger logger = getLogger();
|
Logger logger = getLogger();
|
||||||
Set activeExtractors = getActiveExtractors();
|
Set activeExtractorsInternal = getActiveExtractors();
|
||||||
|
|
||||||
logger.info( "Using " + activeExtractors.size() + " extractors." );
|
logger.info( "Using " + activeExtractorsInternal.size() + " extractors." );
|
||||||
|
|
||||||
int numMojoDescriptors = 0;
|
int numMojoDescriptors = 0;
|
||||||
|
|
||||||
for ( Iterator it = activeExtractors.iterator(); it.hasNext(); )
|
for ( Iterator it = activeExtractorsInternal.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
String language = (String) it.next();
|
String language = (String) it.next();
|
||||||
MojoDescriptorExtractor extractor = (MojoDescriptorExtractor) mojoDescriptorExtractors.get( language );
|
MojoDescriptorExtractor extractor = (MojoDescriptorExtractor) mojoDescriptorExtractors.get( language );
|
||||||
|
|
@ -86,8 +95,8 @@ public class DefaultMojoScanner
|
||||||
|
|
||||||
List extractorDescriptors = extractor.execute( project, pluginDescriptor );
|
List extractorDescriptors = extractor.execute( project, pluginDescriptor );
|
||||||
|
|
||||||
logger.info( "Extractor for language: " + language + " found " + extractorDescriptors.size() +
|
logger.info( "Extractor for language: " + language + " found " + extractorDescriptors.size()
|
||||||
" mojo descriptors." );
|
+ " mojo descriptors." );
|
||||||
numMojoDescriptors += extractorDescriptors.size();
|
numMojoDescriptors += extractorDescriptors.size();
|
||||||
|
|
||||||
for ( Iterator descriptorIt = extractorDescriptors.iterator(); descriptorIt.hasNext(); )
|
for ( Iterator descriptorIt = extractorDescriptors.iterator(); descriptorIt.hasNext(); )
|
||||||
|
|
@ -110,12 +119,16 @@ public class DefaultMojoScanner
|
||||||
{
|
{
|
||||||
logger.warn( "" );
|
logger.warn( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.warn( "*******************************************************" );
|
logger.warn( "*******************************************************" );
|
||||||
logger.warn( "Deprecation Alert:" );
|
logger.warn( "Deprecation Alert:" );
|
||||||
logger.warn("No mojo descriptors were found in this project which has a packaging type of maven-plugin.");
|
logger.warn( "No mojo descriptors were found in this project which has a packaging type of "
|
||||||
|
+ "maven-plugin." );
|
||||||
logger.warn( "In future versions of the plugin tools, this will fail the build." );
|
logger.warn( "In future versions of the plugin tools, this will fail the build." );
|
||||||
logger.warn("If this project is an archetype, change the packaging type from maven-plugin to maven-archetype.");
|
logger.warn( "If this project is an archetype, change the packaging type from maven-plugin to "
|
||||||
|
+ "maven-archetype." );
|
||||||
logger.warn( "********************************************************" );
|
logger.warn( "********************************************************" );
|
||||||
|
|
||||||
for ( int i = 0; i < 10; i++ )
|
for ( int i = 0; i < 10; i++ )
|
||||||
{
|
{
|
||||||
logger.warn( "" );
|
logger.warn( "" );
|
||||||
|
|
@ -140,9 +153,7 @@ public class DefaultMojoScanner
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* @see org.apache.maven.tools.plugin.scanner.MojoScanner#setActiveExtractors(java.util.Set)
|
|
||||||
*/
|
|
||||||
public void setActiveExtractors( Set/* <String> */extractors )
|
public void setActiveExtractors( Set/* <String> */extractors )
|
||||||
{
|
{
|
||||||
if ( extractors == null )
|
if ( extractors == null )
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,10 @@ public interface MojoScanner
|
||||||
String ROLE = MojoScanner.class.getName();
|
String ROLE = MojoScanner.class.getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param project not null
|
||||||
* @param project
|
* @param pluginDescriptor not null
|
||||||
* @param pluginDescriptor
|
* @throws ExtractionException if any
|
||||||
* @throws ExtractionException
|
* @throws InvalidPluginDescriptorException if any
|
||||||
* @throws InvalidPluginDescriptorException
|
|
||||||
*/
|
*/
|
||||||
void populatePluginDescriptor( MavenProject project, PluginDescriptor pluginDescriptor )
|
void populatePluginDescriptor( MavenProject project, PluginDescriptor pluginDescriptor )
|
||||||
throws ExtractionException, InvalidPluginDescriptorException;
|
throws ExtractionException, InvalidPluginDescriptorException;
|
||||||
|
|
@ -52,8 +51,8 @@ public interface MojoScanner
|
||||||
* Only the specified extractors will be used, all others will be skipped.
|
* Only the specified extractors will be used, all others will be skipped.
|
||||||
*
|
*
|
||||||
* @param extractors The names of the sctive extractors. If this parameter is <code>null</code>,
|
* @param extractors The names of the sctive extractors. If this parameter is <code>null</code>,
|
||||||
* all the scanner's extractors are considered active. Set entries that are
|
* all the scanner's extractors are considered active. Set entries that are <code>null</code> or
|
||||||
* <code>null</code> or empty ("") will be ignored.
|
* empty ("") will be ignored.
|
||||||
*/
|
*/
|
||||||
void setActiveExtractors( Set/* <String> */extractors );
|
void setActiveExtractors( Set/* <String> */extractors );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ public final class PluginUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param basedir
|
* @param basedir not null
|
||||||
* @param include
|
* @param include not null
|
||||||
* @return list of included files with default SCM excluded files
|
* @return list of included files with default SCM excluded files
|
||||||
*/
|
*/
|
||||||
public static String[] findSources( String basedir, String include )
|
public static String[] findSources( String basedir, String include )
|
||||||
|
|
@ -81,9 +81,9 @@ public final class PluginUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param basedir
|
* @param basedir not null
|
||||||
* @param include
|
* @param include not null
|
||||||
* @param exclude
|
* @param exclude could be null
|
||||||
* @return list of included files
|
* @return list of included files
|
||||||
*/
|
*/
|
||||||
public static String[] findSources( String basedir, String include, String exclude )
|
public static String[] findSources( String basedir, String include, String exclude )
|
||||||
|
|
@ -160,8 +160,8 @@ public final class PluginUtils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param w not null writer
|
* @param w not null writer
|
||||||
* @param name
|
* @param name not null
|
||||||
* @param value
|
* @param value could be null
|
||||||
*/
|
*/
|
||||||
public static void element( XMLWriter w, String name, String value )
|
public static void element( XMLWriter w, String name, String value )
|
||||||
{
|
{
|
||||||
|
|
@ -185,6 +185,7 @@ public final class PluginUtils
|
||||||
* @throws IllegalArgumentException if any
|
* @throws IllegalArgumentException if any
|
||||||
*/
|
*/
|
||||||
public static boolean isMavenReport( String impl, MavenProject project )
|
public static boolean isMavenReport( String impl, MavenProject project )
|
||||||
|
throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
if ( impl == null )
|
if ( impl == null )
|
||||||
{
|
{
|
||||||
|
|
@ -286,9 +287,9 @@ public final class PluginUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip the header/body stuff
|
// strip the header/body stuff
|
||||||
String LS = System.getProperty( "line.separator" );
|
String ls = System.getProperty( "line.separator" );
|
||||||
int startPos = commentCleaned.indexOf( "<body>" + LS ) + 6 + LS.length();
|
int startPos = commentCleaned.indexOf( "<body>" + ls ) + 6 + ls.length();
|
||||||
int endPos = commentCleaned.indexOf( LS + "</body>" );
|
int endPos = commentCleaned.indexOf( ls + "</body>" );
|
||||||
commentCleaned = commentCleaned.substring( startPos, endPos );
|
commentCleaned = commentCleaned.substring( startPos, endPos );
|
||||||
|
|
||||||
return commentCleaned;
|
return commentCleaned;
|
||||||
|
|
@ -325,29 +326,29 @@ public final class PluginUtils
|
||||||
else if ( "link".equals( tag ) || "linkplain".equals( tag ) || "value".equals( tag ) )
|
else if ( "link".equals( tag ) || "linkplain".equals( tag ) || "value".equals( tag ) )
|
||||||
{
|
{
|
||||||
String pattern = "(([^#\\.\\s]+\\.)*([^#\\.\\s]+))?" + "(#([^\\(\\s]*)(\\([^\\)]*\\))?\\s*(\\S.*)?)?";
|
String pattern = "(([^#\\.\\s]+\\.)*([^#\\.\\s]+))?" + "(#([^\\(\\s]*)(\\([^\\)]*\\))?\\s*(\\S.*)?)?";
|
||||||
final int LABEL = 7;
|
final int label = 7;
|
||||||
final int CLASS = 3;
|
final int clazz = 3;
|
||||||
final int MEMBER = 5;
|
final int member = 5;
|
||||||
final int ARGS = 6;
|
final int args = 6;
|
||||||
Matcher link = Pattern.compile( pattern ).matcher( text );
|
Matcher link = Pattern.compile( pattern ).matcher( text );
|
||||||
if ( link.matches() )
|
if ( link.matches() )
|
||||||
{
|
{
|
||||||
text = link.group( LABEL );
|
text = link.group( label );
|
||||||
if ( StringUtils.isEmpty( text ) )
|
if ( StringUtils.isEmpty( text ) )
|
||||||
{
|
{
|
||||||
text = link.group( CLASS );
|
text = link.group( clazz );
|
||||||
if ( StringUtils.isEmpty( text ) )
|
if ( StringUtils.isEmpty( text ) )
|
||||||
{
|
{
|
||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
if ( StringUtils.isNotEmpty( link.group( MEMBER ) ) )
|
if ( StringUtils.isNotEmpty( link.group( member ) ) )
|
||||||
{
|
{
|
||||||
if ( StringUtils.isNotEmpty( text ) )
|
if ( StringUtils.isNotEmpty( text ) )
|
||||||
{
|
{
|
||||||
text += '.';
|
text += '.';
|
||||||
}
|
}
|
||||||
text += link.group( MEMBER );
|
text += link.group( member );
|
||||||
if ( StringUtils.isNotEmpty( link.group( ARGS ) ) )
|
if ( StringUtils.isNotEmpty( link.group( args ) ) )
|
||||||
{
|
{
|
||||||
text += "()";
|
text += "()";
|
||||||
}
|
}
|
||||||
|
|
@ -381,7 +382,10 @@ public final class PluginUtils
|
||||||
private static String quoteReplacement( String s )
|
private static String quoteReplacement( String s )
|
||||||
{
|
{
|
||||||
if ( ( s.indexOf( '\\' ) == -1 ) && ( s.indexOf( '$' ) == -1 ) )
|
if ( ( s.indexOf( '\\' ) == -1 ) && ( s.indexOf( '$' ) == -1 ) )
|
||||||
|
{
|
||||||
return s;
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for ( int i = 0; i < s.length(); i++ )
|
for ( int i = 0; i < s.length(); i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -401,6 +405,7 @@ public final class PluginUtils
|
||||||
sb.append( c );
|
sb.append( c );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -415,7 +420,7 @@ public final class PluginUtils
|
||||||
{
|
{
|
||||||
Collections.sort( mojoDescriptors, new Comparator()
|
Collections.sort( mojoDescriptors, new Comparator()
|
||||||
{
|
{
|
||||||
|
/** {@inheritDoc} */
|
||||||
public int compare( Object arg0, Object arg1 )
|
public int compare( Object arg0, Object arg1 )
|
||||||
{
|
{
|
||||||
MojoDescriptor mojo0 = (MojoDescriptor) arg0;
|
MojoDescriptor mojo0 = (MojoDescriptor) arg0;
|
||||||
|
|
@ -454,7 +459,25 @@ public final class PluginUtils
|
||||||
final StringBuffer sb = new StringBuffer();
|
final StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
HTMLEditorKit.Parser parser = new ParserDelegator();
|
HTMLEditorKit.Parser parser = new ParserDelegator();
|
||||||
HTMLEditorKit.ParserCallback htmlCallback = new HTMLEditorKit.ParserCallback()
|
HTMLEditorKit.ParserCallback htmlCallback = new MojoParserCallback( sb );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
parser.parse( new StringReader( makeHtmlValid( html ) ), htmlCallback, true );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString().replace( '\"', '\'' ); // for CDATA
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ParserCallback implementation.
|
||||||
|
*/
|
||||||
|
private static class MojoParserCallback
|
||||||
|
extends HTMLEditorKit.ParserCallback
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Holds the index of the current item in a numbered list.
|
* Holds the index of the current item in a numbered list.
|
||||||
|
|
@ -497,6 +520,19 @@ public final class PluginUtils
|
||||||
*/
|
*/
|
||||||
private boolean simpleTag;
|
private boolean simpleTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current buffer.
|
||||||
|
*/
|
||||||
|
private final StringBuffer sb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sb not null
|
||||||
|
*/
|
||||||
|
public MojoParserCallback( StringBuffer sb )
|
||||||
|
{
|
||||||
|
this.sb = sb;
|
||||||
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void handleSimpleTag( HTML.Tag t, MutableAttributeSet a, int pos )
|
public void handleSimpleTag( HTML.Tag t, MutableAttributeSet a, int pos )
|
||||||
{
|
{
|
||||||
|
|
@ -575,7 +611,8 @@ public final class PluginUtils
|
||||||
|| HTML.Tag.UL.equals( t ) || HTML.Tag.DL.equals( t ) )
|
|| HTML.Tag.UL.equals( t ) || HTML.Tag.DL.equals( t ) )
|
||||||
&& numbering.isEmpty() )
|
&& numbering.isEmpty() )
|
||||||
{
|
{
|
||||||
newline( pendingNewline = false );
|
pendingNewline = false;
|
||||||
|
newline( pendingNewline );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -675,17 +712,5 @@ public final class PluginUtils
|
||||||
}
|
}
|
||||||
sb.append( text );
|
sb.append( text );
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
parser.parse( new StringReader( makeHtmlValid( html ) ), htmlCallback, true );
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
throw new RuntimeException( e );
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString().replace( '\"', '\'' ); // for CDATA
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue