You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/10/03 20:06:23 UTC
svn commit: r293410 - in /maven/components/trunk: maven-core/
maven-core/src/main/java/org/apache/maven/plugin/
maven-core/src/main/java/org/apache/maven/usability/
maven-core/src/main/java/org/apache/maven/usability/plugin/
maven-core/src/main/resourc...
Author: jdcasey
Date: Mon Oct 3 11:06:00 2005
New Revision: 293410
URL: http://svn.apache.org/viewcvs?rev=293410&view=rev
Log:
Fixing error messages related to invalid plugin configuration, similar to the instantiation exception for ArtifactRepository when there is no deployment repository...
o Moved the parameter documentation reader to a separate project, so that I can use Modello.
o Added some more parameter documentation.
Added:
maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml (with props)
maven/components/trunk/maven-plugin-parameter-documenter/
maven/components/trunk/maven-plugin-parameter-documenter/pom.xml (with props)
maven/components/trunk/maven-plugin-parameter-documenter/src/
maven/components/trunk/maven-plugin-parameter-documenter/src/main/
maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/
maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo (with props)
maven/components/trunk/maven-plugin-parameter-documenter/src/test/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java (with props)
maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/
maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml (with props)
Removed:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentation.java
Modified:
maven/components/trunk/maven-core/pom.xml
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml
maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml
maven/components/trunk/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java
maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedderLogger.java
maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/PlexusLoggerAdapter.java
maven/components/trunk/maven-mboot2/src/main/java/MBoot.java
maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
Modified: maven/components/trunk/maven-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/pom.xml?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/pom.xml (original)
+++ maven/components/trunk/maven-core/pom.xml Mon Oct 3 11:06:00 2005
@@ -88,6 +88,11 @@
<version>2.0-beta-3-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-parameter-documenter</artifactId>
+ <version>2.0-beta-3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.0</version>
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Mon Oct 3 11:06:00 2005
@@ -624,15 +624,15 @@
}
catch ( ArtifactResolutionException e )
{
- throw new PluginConfigurationException( "Cannot resolve plugin dependencies", e );
+ throw new PluginConfigurationException( pluginDescriptor, "Cannot resolve plugin dependencies", e );
}
catch ( PlexusContainerException e )
{
- throw new PluginConfigurationException( "Cannot start plugin container", e );
+ throw new PluginConfigurationException( pluginDescriptor, "Cannot start plugin container", e );
}
catch ( ArtifactMetadataRetrievalException e )
{
- throw new PluginConfigurationException( "Cannot resolve plugin dependencies", e );
+ throw new PluginConfigurationException( pluginDescriptor, "Cannot resolve plugin dependencies", e );
}
}
}
@@ -779,7 +779,7 @@
}
catch ( ExpressionEvaluationException e )
{
- throw new PluginConfigurationException( "Bad expression", e );
+ throw new PluginConfigurationException( goal.getPluginDescriptor(), "Bad expression", e );
}
// only mark as invalid if there are no child nodes
@@ -832,7 +832,7 @@
errorMessage.append( key );
errorMessage.append( " in goal: " ).append( goal.getFullGoalName() );
- throw new PluginConfigurationException( errorMessage.toString() );
+ throw new PluginConfigurationException( goal.getPluginDescriptor(), errorMessage.toString() );
}
String deprecated = parameter.getDeprecated();
@@ -1036,12 +1036,13 @@
}
catch ( ComponentConfigurationException e )
{
- throw new PluginConfigurationException( "Unable to parse the created DOM for plugin configuration", e );
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), "Unable to parse the created DOM for plugin configuration", e );
}
catch ( ComponentLookupException e )
{
- throw new PluginConfigurationException(
- "Unable to retrieve component configurator for plugin configuration", e );
+ throw new PluginConfigurationException(mojoDescriptor.getPluginDescriptor(),
+ "Unable to retrieve component configurator for plugin configuration",
+ e );
}
finally
{
@@ -1152,6 +1153,7 @@
artifacts.add( "maven-monitor" );
artifacts.add( "maven-plugin-api" );
artifacts.add( "maven-plugin-descriptor" );
+ artifacts.add( "maven-plugin-parameter-documenter" );
artifacts.add( "maven-repository-metadata" );
artifacts.add( "maven-plugin-registry" );
artifacts.add( "maven-profile" );
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java Mon Oct 3 11:06:00 2005
@@ -1,5 +1,7 @@
package org.apache.maven.plugin;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
@@ -23,18 +25,36 @@
public class PluginConfigurationException
extends Exception
{
- public PluginConfigurationException( String message )
+ private final PluginDescriptor pluginDescriptor;
+ private String originalMessage;
+
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String message )
{
- super( message );
+ super( "Error configuring: " + pluginDescriptor.getPluginLookupKey() + ". Reason: " + message );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = message;
}
- public PluginConfigurationException( Throwable cause )
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, Throwable cause )
{
- super( cause );
+ super( "Error configuring: " + pluginDescriptor.getPluginLookupKey() + ".", cause );
+ this.pluginDescriptor = pluginDescriptor;
}
- public PluginConfigurationException( String message, Throwable cause )
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String message, Throwable cause )
+ {
+ super( "Error configuring: " + pluginDescriptor.getPluginLookupKey() + ". Reason: " + message, cause );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = message;
+ }
+
+ public PluginDescriptor getPluginDescriptor()
+ {
+ return pluginDescriptor;
+ }
+
+ public String getOriginalMessage()
{
- super( message, cause );
+ return originalMessage;
}
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java Mon Oct 3 11:06:00 2005
@@ -30,7 +30,7 @@
public PluginParameterException( MojoDescriptor mojo, List parameters )
{
- super( "Invalid or missing parameters: " + parameters + " for mojo: " + mojo.getRoleHint() );
+ super( mojo.getPluginDescriptor(), "Invalid or missing parameters: " + parameters + " for mojo: " + mojo.getRoleHint() );
this.mojo = mojo;
@@ -39,7 +39,7 @@
public PluginParameterException( MojoDescriptor mojo, List parameters, Throwable cause )
{
- super( "Invalid or missing parameters: " + parameters + " for mojo: " + mojo.getRoleHint(), cause );
+ super( mojo.getPluginDescriptor(), "Invalid or missing parameters: " + parameters + " for mojo: " + mojo.getRoleHint(), cause );
this.mojo = mojo;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java Mon Oct 3 11:06:00 2005
@@ -20,10 +20,12 @@
import org.apache.maven.plugin.PluginParameterException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.usability.plugin.ExpressionDocumenter;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.usability.plugin.Expression;
import org.apache.maven.usability.plugin.ExpressionDocumentationException;
-import org.apache.maven.usability.plugin.ExpressionDocumentation;
+import org.apache.maven.usability.plugin.ExpressionDocumenter;
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.util.StringUtils;
import java.io.PrintWriter;
@@ -32,7 +34,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Stack;
+import java.util.Properties;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -48,6 +50,7 @@
List exprs = new ArrayList();
exprs.add( "localRepository" );
+ exprs.add( "reactorProjects" );
exprs.add( "settings" );
exprs.add( "project" );
exprs.add( "session" );
@@ -59,23 +62,26 @@
public boolean canDiagnose( Throwable error )
{
- return DiagnosisUtils.containsInCausality(error, PluginConfigurationException.class );
+ return DiagnosisUtils.containsInCausality( error, PluginConfigurationException.class );
}
public String diagnose( Throwable error )
{
- PluginConfigurationException pce = (PluginConfigurationException) DiagnosisUtils.getFromCausality(error, PluginConfigurationException.class );
-
+ PluginConfigurationException pce = (PluginConfigurationException) DiagnosisUtils
+ .getFromCausality( error, PluginConfigurationException.class );
+
if ( pce instanceof PluginParameterException )
{
PluginParameterException exception = (PluginParameterException) pce;
return buildParameterDiagnosticMessage( exception );
}
- else if( DiagnosisUtils.containsInCausality(pce, ComponentConfigurationException.class ) )
+ else if ( DiagnosisUtils.containsInCausality( pce, ComponentConfigurationException.class ) )
{
- ComponentConfigurationException cce = (ComponentConfigurationException) DiagnosisUtils.getFromCausality( pce, ComponentConfigurationException.class );
- return buildInvalidPluginConfigurationDiagnosisMessage( cce );
+ ComponentConfigurationException cce = (ComponentConfigurationException) DiagnosisUtils
+ .getFromCausality( pce, ComponentConfigurationException.class );
+
+ return buildConfigurationDiagnosticMessage( pce, cce );
}
else
{
@@ -83,14 +89,28 @@
}
}
- private String buildInvalidPluginConfigurationDiagnosisMessage( ComponentConfigurationException cce )
+ private String buildConfigurationDiagnosticMessage( PluginConfigurationException pce, ComponentConfigurationException cce )
{
StringBuffer message = new StringBuffer();
- message.append( "Either your POM or one of its ancestors has declared an invalid plugin configuration.\n" )
- .append( "The error message is:\n\n" )
- .append( cce.getMessage() ).append( "\n" );
+ PluginDescriptor descriptor = pce.getPluginDescriptor();
+
+ PlexusConfiguration failedConfiguration = cce.getFailedConfiguration();
+
+ message.append( "Failed to configure plugin parameters for: " + descriptor.getId() + "\n\n" );
+
+ if ( failedConfiguration != null )
+ {
+ String value = failedConfiguration.getValue( null );
+ addParameterUsageInfo( value, message );
+ }
+
+ message.append( "Reason: " ).append( cce.getMessage() ).append( "\n" );
+ Throwable root = DiagnosisUtils.getRootCause( cce );
+
+ message.append( "Root Cause: " ).append( root.getMessage() ).append( "\n\n" );
+
return message.toString();
}
@@ -101,8 +121,9 @@
List params = exception.getParameters();
MojoDescriptor mojo = exception.getMojoDescriptor();
- messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" ).append(
- mojo.getPluginDescriptor().getGoalPrefix() ).append( ":" ).append( mojo.getGoal() ).append( "\'\n" );
+ messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" )
+ .append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ":" ).append( mojo.getGoal() )
+ .append( "\'\n" );
int idx = 0;
for ( Iterator it = params.iterator(); it.hasNext(); )
@@ -112,7 +133,7 @@
messageBuffer.append( "\n[" ).append( idx++ ).append( "] " );
decomposeParameterIntoUserInstructions( mojo, param, messageBuffer );
-
+
messageBuffer.append( "\n" );
}
@@ -120,18 +141,21 @@
}
private void decomposeParameterIntoUserInstructions( MojoDescriptor mojo, Parameter param,
- StringBuffer messageBuffer )
+ StringBuffer messageBuffer )
{
String expression = param.getExpression();
if ( param.isEditable() )
{
- messageBuffer.append( "inside the definition for plugin: \'" + mojo.getPluginDescriptor().getArtifactId() + "\'specify the following:\n\n<configuration>\n ...\n <" + param.getName() + ">VALUE</" + param.getName() + ">\n</configuration>" );
+ messageBuffer.append( "inside the definition for plugin: \'" + mojo.getPluginDescriptor().getArtifactId()
+ + "\'specify the following:\n\n<configuration>\n ...\n <" + param.getName() + ">VALUE</"
+ + param.getName() + ">\n</configuration>" );
String alias = param.getAlias();
if ( StringUtils.isNotEmpty( alias ) )
{
- messageBuffer.append( "\n\n-OR-\n\n<configuration>\n ...\n <" + alias + ">VALUE</" + alias + ">\n</configuration>\n" );
+ messageBuffer.append( "\n\n-OR-\n\n<configuration>\n ...\n <" + alias + ">VALUE</" + alias
+ + ">\n</configuration>\n" );
}
}
@@ -141,35 +165,54 @@
}
else
{
- StringBuffer expressionMessageBuffer = new StringBuffer();
-
if ( param.isEditable() )
{
- expressionMessageBuffer.append( "\n\n-OR-\n\n" );
+ messageBuffer.append( "\n\n-OR-\n\n" );
}
+
+ addParameterUsageInfo( expression, messageBuffer );
+ }
+ }
- Matcher exprMatcher = Pattern.compile( "\\$\\{(.+)\\}" ).matcher( expression );
+ private void addParameterUsageInfo( String expression, StringBuffer messageBuffer )
+ {
+ StringBuffer expressionMessageBuffer = new StringBuffer();
+
+ Matcher exprMatcher = Pattern.compile( "\\$\\{(.+)\\}" ).matcher( expression );
- boolean unmodifiableElementsFound = false;
- boolean activeElementsFound = false;
+ boolean unmodifiableElementsFound = false;
+ boolean activeElementsFound = false;
- int elementCount = 0;
+ int elementCount = 0;
- while ( exprMatcher.find() )
- {
- elementCount++;
+ while ( exprMatcher.find() )
+ {
+ elementCount++;
- activeElementsFound = true;
+ activeElementsFound = true;
- String subExpression = exprMatcher.group( 1 );
+ String subExpression = exprMatcher.group( 1 );
- StringTokenizer expressionParts = new StringTokenizer( subExpression, "." );
+ StringTokenizer expressionParts = new StringTokenizer( subExpression, "." );
- String firstPart = expressionParts.nextToken();
+ String firstPart = expressionParts.nextToken();
- if ( expressionParts.hasMoreTokens() && ( "project".equals( firstPart ) || "settings".equals( firstPart ) ) )
+ try
+ {
+ Map expressions = ExpressionDocumenter.load();
+ Expression expr = (Expression) expressions.get( subExpression );
+
+ if ( expr != null )
{
- addParameterConfigDocumentation( firstPart, exprMatcher.group( 0 ), subExpression, expressionMessageBuffer );
+ if ( !expr.isEditable() )
+ {
+ unmodifiableElementsFound = true;
+ }
+ else
+ {
+ addParameterConfigDocumentation( firstPart, exprMatcher.group( 0 ), subExpression,
+ expressionMessageBuffer );
+ }
}
else if ( UNMODIFIABLE_EXPRESSIONS.contains( subExpression ) )
{
@@ -177,91 +220,134 @@
}
else
{
- expressionMessageBuffer.append( "on the command line, specify: \'-D" ).append( subExpression ).append("=VALUE\'" );
+ expressionMessageBuffer.append( "on the command line, specify: \'-D" ).append( subExpression )
+ .append( "=VALUE\'" );
}
}
+ catch ( ExpressionDocumentationException e )
+ {
+ expressionMessageBuffer.append( "\n\nERROR!! Failed to load expression documentation!" );
+
+ StringWriter sWriter = new StringWriter();
+ PrintWriter pWriter = new PrintWriter( sWriter );
+
+ e.printStackTrace( pWriter );
+
+ expressionMessageBuffer.append( "\n\nException:\n\n" ).append( sWriter.toString() );
+ }
+ }
- if ( activeElementsFound )
+ if ( activeElementsFound )
+ {
+ messageBuffer.append( expressionMessageBuffer );
+ }
+ else
+ {
+ messageBuffer.append( " (found static expression: \'" + expression
+ + "\' which may act as a default value).\n" );
+ }
+
+ if ( unmodifiableElementsFound )
+ {
+ if ( elementCount > 1 )
{
- messageBuffer.append( expressionMessageBuffer );
+ messageBuffer.append( " " );
}
- else
+
+ messageBuffer
+ .append( "NOTE: One or more purely derived expression elements were detected in \'"
+ + expression
+ + "\'.\n If you continue to get this error after any other expression elements are specified correctly,"
+ + "\n please report this issue to the Maven development team.\n" );
+ }
+ }
+
+ private void addParameterConfigDocumentation( String firstPart, String wholeExpression, String subExpression,
+ StringBuffer expressionMessageBuffer )
+ throws ExpressionDocumentationException
+ {
+ Map expressionDoco = ExpressionDocumenter.load();
+
+ Expression expr = (Expression) expressionDoco.get( subExpression );
+
+ if ( expr != null )
+ {
+ expressionMessageBuffer.append( "check that the following section of " );
+ if ( "project".equals( firstPart ) )
{
- messageBuffer.append( " (found static expression: \'" + expression +
- "\' which may act as a default value).\n" );
+ expressionMessageBuffer.append( "the pom.xml " );
}
+ else if ( "settings".equals( firstPart ) )
+ {
+ expressionMessageBuffer.append( "your ~/.m2/settings.xml file " );
+ }
+
+ expressionMessageBuffer.append( "is present and correct:\n\n" );
- if ( unmodifiableElementsFound )
+ String message = expr.getConfiguration();
+
+ if ( message == null )
{
- if ( elementCount > 1 )
- {
- messageBuffer.append( " " );
- }
+ message = expr.getDescription();
+ }
+
+ expressionMessageBuffer.append( message );
+
+ Properties cliConfig = expr.getCliOptions();
+
+ if ( cliConfig != null && !cliConfig.isEmpty() )
+ {
+ expressionMessageBuffer.append( "\n\n-OR-\n\nUse the following command-line switches:\n" );
- messageBuffer.append( "NOTE: One or more purely derived expression elements were detected in \'" +
- expression +
- "\'.\n If you continue to get this error after any other expression elements are specified correctly," +
- "\n please report this issue to the Maven development team.\n" );
+ prettyPrintCommandLineSwitches( cliConfig, '.', expressionMessageBuffer );
}
}
+ else
+ {
+ expressionMessageBuffer.append( "ensure that the expression: \'" + wholeExpression + "\' is satisfied" );
+ }
}
- private void addParameterConfigDocumentation( String firstPart, String wholeExpression, String subExpression, StringBuffer expressionMessageBuffer )
+ private void prettyPrintCommandLineSwitches( Properties switches, char filler, StringBuffer expressionMessageBuffer )
{
- try
- {
- Map expressionDoco = ExpressionDocumenter.load();
+ int maxKeyLen = 0;
- ExpressionDocumentation info = (ExpressionDocumentation) expressionDoco.get( subExpression );
+ for ( Iterator it = switches.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) it.next();
- if ( info != null )
- {
- expressionMessageBuffer.append( "check that the following section of " );
- if ( "project".equals( firstPart ) )
- {
- expressionMessageBuffer.append( "the pom.xml " );
- }
- else if ( "settings".equals( firstPart ) )
- {
- expressionMessageBuffer.append( "your ~/.m2/settings.xml file " );
- }
+ String key = (String) entry.getKey();
- expressionMessageBuffer.append( "is present and correct:\n\n" );
-
- String message = info.getOrigin();
-
- if ( message == null )
- {
- message = info.getUsage();
- }
-
- expressionMessageBuffer.append( message );
-
- String addendum = info.getAddendum();
-
- if ( addendum != null )
- {
- expressionMessageBuffer.append("\n\n").append( addendum );
- }
- }
- else
+ int keyLen = key.length();
+ if ( keyLen > maxKeyLen )
{
- expressionMessageBuffer.append( "ensure that the expression: \'"
- + wholeExpression + "\' is satisfied" );
+ maxKeyLen = keyLen;
}
-
}
- catch ( ExpressionDocumentationException e )
+
+ final int minFillerCount = 4;
+
+ for ( Iterator it = switches.entrySet().iterator(); it.hasNext(); )
{
- expressionMessageBuffer.append( "\n\nERROR!! Failed to load expression documentation!" );
+ Map.Entry entry = (Map.Entry) it.next();
+
+ String key = (String) entry.getKey();
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter( sWriter );
+ int keyLen = key.length();
- e.printStackTrace( pWriter );
+ int fillerCount = maxKeyLen - keyLen + minFillerCount;
- expressionMessageBuffer.append( "\n\nException:\n\n" ).append( sWriter.toString() );
+ expressionMessageBuffer.append( '\n' ).append( key ).append( ' ' );
+
+ for ( int i = 0; i < fillerCount; i++ )
+ {
+ expressionMessageBuffer.append( filler );
+ }
+
+ expressionMessageBuffer.append( ' ' ).append( entry.getValue() );
}
+
+ expressionMessageBuffer.append( '\n' );
}
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java Mon Oct 3 11:06:00 2005
@@ -1,30 +1,29 @@
package org.apache.maven.usability.plugin;
+import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader;
import org.codehaus.plexus.util.IOUtil;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
public class ExpressionDocumenter
{
- private static final String[] EXPRESSION_ROOTS = { "project", "settings", "session", "plugin" };
+ private static final String[] EXPRESSION_ROOTS = { "project", "settings", "session", "plugin", "rootless" };
private static final String EXPRESSION_DOCO_ROOTPATH = "META-INF/maven/plugin-expressions/";
@@ -58,14 +57,10 @@
{
throw new ExpressionDocumentationException( "Failed to read documentation for expression root: " + EXPRESSION_ROOTS[i], e );
}
- catch ( ParserConfigurationException e )
+ catch ( XmlPullParserException e )
{
throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: " + EXPRESSION_ROOTS[i], e );
}
- catch ( SAXException e )
- {
- throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: " + EXPRESSION_ROOTS[i], e.getException() );
- }
finally
{
IOUtil.close( docStream );
@@ -101,20 +96,32 @@
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
+ * @throws XmlPullParserException
*/
private static Map parseExpressionDocumentation( InputStream docStream )
- throws IOException, ParserConfigurationException, SAXException
+ throws IOException, XmlPullParserException
{
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
-
- ExpressionInfoParser eiParser = new ExpressionInfoParser();
+ Reader reader = new BufferedReader( new InputStreamReader( docStream ) );
- InputSource is = new InputSource( docStream );
-
- parser.parse( new InputSource( docStream ), eiParser );
-
- return eiParser.getExpressionInfoMappings();
+ ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader();
+
+ ExpressionDocumentation documentation = paramdocReader.read( reader );
+
+ List expressions = documentation.getExpressions();
+
+ Map bySyntax = new HashMap();
+
+ if ( expressions != null && !expressions.isEmpty() )
+ {
+ for ( Iterator it = expressions.iterator(); it.hasNext(); )
+ {
+ Expression expr = (Expression) it.next();
+
+ bySyntax.put( expr.getSyntax(), expr );
+ }
+ }
+
+ return bySyntax;
}
private static ClassLoader initializeDocLoader()
@@ -146,142 +153,6 @@
}
return new URLClassLoader( new URL[] { docResource } );
- }
-
- private static final class ExpressionInfoParser
- extends DefaultHandler
- {
-
- private static final String EXPRESSION = "expression";
-
- private static final String SYNTAX = "syntax";
-
- private static final String ORIGIN = "origin";
-
- private static final String USAGE = "usage";
-
- private static final String BAN = "ban";
-
- private static final String DEPRECATION = "deprecation";
-
- private static final String ADDENDUM = "addendum";
-
- private Map expressionInfos = new HashMap();
-
- private StringBuffer currentBuffer;
-
- private StringBuffer currentExpressionName;
-
- private StringBuffer currentUsage;
-
- private StringBuffer currentOrigin;
-
- private StringBuffer currentAddendum;
-
- private StringBuffer currentBan;
-
- private StringBuffer currentDeprecation;
-
- Map getExpressionInfoMappings()
- {
- return expressionInfos;
- }
-
- public void characters( char[] ch, int start, int length )
- throws SAXException
- {
- if ( currentBuffer != null )
- {
- currentBuffer.append( ch, start, length );
- }
- }
-
- public void endElement( String uri, String localName, String qName )
- throws SAXException
- {
- if ( EXPRESSION.equals( qName ) )
- {
- String expression = currentExpressionName.toString().trim();
-
- ExpressionDocumentation ei = new ExpressionDocumentation();
- ei.setExpression( expression );
-
- if ( currentUsage != null )
- {
- ei.setUsage( currentUsage.toString().trim() );
- }
-
- if ( currentOrigin != null )
- {
- ei.setOrigin( currentOrigin.toString().trim() );
- }
-
- if ( currentBan != null )
- {
- ei.setBanMessage( currentBan.toString().trim() );
- }
-
- if ( currentDeprecation != null )
- {
- ei.setDeprecationMessage( currentDeprecation.toString().trim() );
- }
-
- if ( currentAddendum != null )
- {
- ei.setAddendum( currentAddendum.toString().trim() );
- }
-
- expressionInfos.put( expression, ei );
-
- reset();
- }
- }
-
- private void reset()
- {
- currentExpressionName = null;
- currentUsage = null;
- currentOrigin = null;
- currentBan = null;
- currentDeprecation = null;
- currentAddendum = null;
- currentBuffer = null;
- }
-
- public void startElement( String uri, String localName, String qName, Attributes attributes )
- throws SAXException
- {
- if ( SYNTAX.equals( qName ) )
- {
- currentExpressionName = new StringBuffer();
- currentBuffer = currentExpressionName;
- }
- else if ( ORIGIN.equals( qName ) )
- {
- currentOrigin = new StringBuffer();
- currentBuffer = currentOrigin;
- }
- else if ( USAGE.equals( qName ) )
- {
- currentUsage = new StringBuffer();
- currentBuffer = currentUsage;
- }
- else if ( BAN.equals( qName ) )
- {
- currentBan = new StringBuffer();
- currentBuffer = currentBan;
- }
- else if ( DEPRECATION.equals( qName ) )
- {
- currentDeprecation = new StringBuffer();
- currentBuffer = currentDeprecation;
- }
- else if ( ADDENDUM.equals( qName ) )
- {
- currentAddendum = new StringBuffer();
- currentBuffer = currentAddendum;
- }
- }
}
}
Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml Mon Oct 3 11:06:00 2005
@@ -1,7 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<paramdoc xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ../../../../../../../maven-plugin-parameter-documenter/target/generated-site/xsd/paramdoc-1.0.0.xsd ">
<expressions>
<expression>
<syntax>project.distributionManagementArtifactRepository</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
@@ -16,124 +19,135 @@
<url>scp://host/path/to/repo</url>
</snapshotRepository>
</distributionManagement>
- ]]></origin>
- <usage>
- This is the ArtifactRepository used to deploy artifacts built by this Maven.
- </usage>
+ ]]></configuration>
+ <description> This is the ArtifactRepository used to deploy artifacts built by this
+ Maven.
+ </description>
</expression>
<expression>
<syntax>project.artifact</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<groupId>project.group</groupId>
<artifactId>project-artifact</artifactId>
<version>0.0.0.0</version>
<packaging>type</packaging>
- ]]></origin>
- <usage>
- This is the Artifact instance created from the essential project attributes:
- groupId, artifactId, version, and packaging (with a default packaging of 'jar').
- </usage>
+ ]]></configuration>
+ <description> This is the Artifact instance created from the essential project
+ attributes: groupId, artifactId, version, and packaging (with a default packaging of
+ 'jar').
+ </description>
</expression>
<expression>
<syntax>project.parent</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<parent>
<groupId>project.group</groupId>
<artifactId>project-artifact</artifactId>
<version>0.0.0.0</version>
</parent>
- ]]></origin>
- <usage>
- This is the MavenProject instance for the parent of the current POM.
- </usage>
+ ]]></configuration>
+ <description> This is the MavenProject instance for the parent of the current POM.
+ </description>
</expression>
<expression>
<syntax>project.file</syntax>
- <usage>
- This is the File instance that refers to the location of the current POM on disk.
- </usage>
+ <description> This is the File instance that refers to the location of the current POM on
+ disk.
+ </description>
</expression>
<expression>
<syntax>project.artifacts</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<dependencies>
...
</dependencies>
- ]]></origin>
- <usage><![CDATA[
+ ]]></configuration>
+ <description>
+ <![CDATA[
This is a set of Artifact instances resolved from the set of dependencies for
the current project.
NOTE: This will likely contain much more than the direct dependencies of the
current POM, since Maven uses transitive, or chained, dependency resolution.
- ]]></usage>
+ ]]></description>
</expression>
<expression>
<syntax>project.parentArtifact</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<parent>
<groupId>project.group</groupId>
<artifactId>project-artifact</artifactId>
<version>0.0.0.0</version>
</parent>
- ]]></origin>
- <usage>
- This is the Artifact instance for the parent of the current POM.
- </usage>
+ ]]></configuration>
+ <description> This is the Artifact instance for the parent of the current POM.
+ </description>
</expression>
<expression>
<syntax>project.pluginArtifacts</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<build>
<plugins>
...
</plugins>
</build>
- ]]></origin>
- <usage><![CDATA[
+ ]]></configuration>
+ <description>
+ <![CDATA[
This is the list of Artifact instances for plugins used in the current build
for this project.
NOTE: This list may contain plugin Artifacts which are implied by the current POM's
packaging and the lifecycle phase being built.
- ]]></usage>
+ ]]></description>
</expression>
<expression>
<syntax>project.remoteArtifactRepositories</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<repositories>
...
</repositories>
- ]]></origin>
- <usage><![CDATA[
+ ]]></configuration>
+ <description>
+ <![CDATA[
This is a list of ArtifactRepository instances used to resolve the Artifacts associated
with the current POM.
NOTE: This list will contain entries for repositories specified by ancestor POMs, including
the default built-in super-POM, which is the parent of all POMs.
- ]]></usage>
+ ]]></description>
</expression>
<expression>
<syntax>project.pluginArtifactRepositories</syntax>
- <origin><![CDATA[
+ <configuration>
+ <![CDATA[
<pluginRepositories>
...
</pluginRepositories>
- ]]></origin>
- <usage><![CDATA[
+ ]]></configuration>
+ <description>
+ <![CDATA[
This is a list of ArtifactRepository instances used to resolve the Artifacts associated
with plugins used in building the current POM.
NOTE: This list will contain entries for repositories specified by ancestor POMs, including
the default built-in super-POM, which is the parent of all POMs.
- ]]></usage>
+ ]]></description>
</expression>
<expression>
<syntax>project.attachedArtifacts</syntax>
- <usage><![CDATA[
+ <description>
+ <![CDATA[
This is a list of attachments to the main artifact produced by building the current POM.
Attachments are derived works, based on the main build process, such as an ejb-client jar,
project sources jar, etc.
- ]]></usage>
+ ]]></description>
</expression>
-</expressions>
\ No newline at end of file
+</expressions>
+</paramdoc>
\ No newline at end of file
Added: maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml?rev=293410&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml (added)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml Mon Oct 3 11:06:00 2005
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<paramdoc xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ../../../../../../../maven-plugin-parameter-documenter/target/generated-site/xsd/paramdoc-1.0.0.xsd ">
+ <expressions>
+ <expression>
+ <syntax>localRepository</syntax>
+ <configuration>
+ <![CDATA[
+ Inside ~/.m2/settings.xml:
+
+ <localRepository>/path/to/local/repository</localRepository>
+ ]]></configuration>
+ <description>The ArtifactRepository instance referencing the local artifact
+ repository.</description>
+ <cliOptions>
+ <cliOption>
+ <key>-Dmaven.repo.local=/path/to/local/repo</key>
+ <value>Override the local repository location on a per-build basis.</value>
+ </cliOption>
+ </cliOptions>
+ </expression>
+ <expression>
+ <syntax>reactorProjects</syntax>
+ <description>This is the current list of projects being built by
+ Maven.</description>
+ </expression>
+ </expressions>
+</paramdoc>
Propchange: maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml Mon Oct 3 11:06:00 2005
@@ -1,27 +1,34 @@
-<expressions>
- <expression>
- <syntax>settings.offline</syntax>
- <origin><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<paramdoc xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ../../../../../../../maven-plugin-parameter-documenter/target/generated-site/xsd/paramdoc-1.0.0.xsd ">
+ <expressions>
+ <expression>
+ <syntax>settings.offline</syntax>
+ <configuration>
+ <![CDATA[
<offline>true</offline>
- ]]></origin>
- <usage>
+ ]]></configuration>
+ <description>
+ <![CDATA[
Flags the system as offline, to prevent accessing the network to resolve artifacts or execute plugins.
- </usage>
- <addendum><![CDATA[
- NOTE: It's also possible to switch to offline mode on a per-build basis, using the '-o' command-line option.
- ]]></addendum>
- </expression>
- <expression>
- <syntax>settings.interactiveMode</syntax>
- <origin><![CDATA[
+
+ NOTE: It's also possible to switch to offline mode on a per-build basis, using the '-o' command-line option.
+ ]]></description>
+ </expression>
+ <expression>
+ <syntax>settings.interactiveMode</syntax>
+ <configuration>
+ <![CDATA[
<interactiveMode>true</interactiveMode>
- ]]></origin>
- <usage>
+ ]]></configuration>
+ <description>
+ <![CDATA[
If false, flags the system to skip prompting the user for any information, or holding up the build
waiting for any input.
- </usage>
- <addendum><![CDATA[
- NOTE: It's also possible to switch to batch (ie. non-interactive) mode using the '-B' command-line option.
- ]]></addendum>
- </expression>
-</expressions>
\ No newline at end of file
+
+ NOTE: It's also possible to switch to batch (ie. non-interactive) mode using the '-B' command-line option.
+ ]]></description>
+ </expression>
+ </expressions>
+</paramdoc>
\ No newline at end of file
Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java Mon Oct 3 11:06:00 2005
@@ -61,7 +61,12 @@
ComponentConfigurationException cce = new ComponentConfigurationException(
"Class \'org.apache.maven.plugin.jar.JarMojo\' does not contain a field named \'addClasspath\'" );
- PluginConfigurationException pce = new PluginConfigurationException( "test", cce );
+
+ PluginDescriptor pd = new PluginDescriptor();
+ pd.setGroupId("testGroup");
+ pd.setArtifactId("testArtifact");
+
+ PluginConfigurationException pce = new PluginConfigurationException( pd, "test", cce );
assertTrue( diagnoser.canDiagnose( pce ) );
Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedderLogger.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedderLogger.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedderLogger.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedderLogger.java Mon Oct 3 11:06:00 2005
@@ -18,7 +18,7 @@
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id:$
+ * @version $Id$
*/
public interface MavenEmbedderLogger
{
Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/PlexusLoggerAdapter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/PlexusLoggerAdapter.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/PlexusLoggerAdapter.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/PlexusLoggerAdapter.java Mon Oct 3 11:06:00 2005
@@ -18,7 +18,7 @@
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id:$
+ * @version $Id$
*/
public class PlexusLoggerAdapter
implements Logger
Modified: maven/components/trunk/maven-mboot2/src/main/java/MBoot.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-mboot2/src/main/java/MBoot.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-mboot2/src/main/java/MBoot.java (original)
+++ maven/components/trunk/maven-mboot2/src/main/java/MBoot.java Mon Oct 3 11:06:00 2005
@@ -42,7 +42,7 @@
"maven-artifact", "maven-plugin-descriptor", "maven-repository-metadata", "maven-artifact-manager",
"maven-artifact-test", "maven-script/maven-script-beanshell",
"maven-profile", "maven-project", "maven-plugin-registry", "maven-reporting/maven-reporting-api",
- "maven-reporting/maven-reporting-impl", "maven-core", "maven-archiver",
+ "maven-reporting/maven-reporting-impl", "maven-plugin-parameter-documenter", "maven-core", "maven-archiver",
"maven-plugin-tools/maven-plugin-tools-api", "maven-plugin-tools/maven-plugin-tools-java",
"maven-plugin-tools/maven-plugin-tools-beanshell", "maven-plugin-tools/maven-plugin-tools-pluggy",
"maven-core-it-verifier"};
@@ -63,6 +63,7 @@
targetVersions.put( "maven-profile", "1.0.0" );
targetVersions.put( "maven-plugin-registry", "1.0.0" );
targetVersions.put( "maven-plugin-descriptor", "1.0.0" );
+ targetVersions.put( "maven-plugin-parameter-documenter", "1.0.0" );
targetVersions.put( "maven-repository-metadata", "1.0.0" );
MODELLO_TARGET_VERSIONS = Collections.unmodifiableMap( targetVersions );
@@ -73,6 +74,7 @@
modelFiles.put( "maven-profile", "profiles.mdo" );
modelFiles.put( "maven-plugin-registry", "plugin-registry.mdo" );
modelFiles.put( "maven-plugin-descriptor", "src/main/mdo/lifecycle.mdo" );
+ modelFiles.put( "maven-plugin-parameter-documenter", "src/main/mdo/paramdoc.mdo" );
modelFiles.put( "maven-repository-metadata", "src/main/mdo/metadata.mdo" );
MODELLO_MODEL_FILES = Collections.unmodifiableMap( modelFiles );
Added: maven/components/trunk/maven-plugin-parameter-documenter/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-parameter-documenter/pom.xml?rev=293410&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-parameter-documenter/pom.xml (added)
+++ maven/components/trunk/maven-plugin-parameter-documenter/pom.xml Mon Oct 3 11:06:00 2005
@@ -0,0 +1,54 @@
+<project>
+ <parent>
+ <artifactId>maven</artifactId>
+ <groupId>org.apache.maven</groupId>
+ <version>2.0-beta-3-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>maven-plugin-parameter-documenter</artifactId>
+ <name>Maven Plugin Parameter Documenter API</name>
+ <version>2.0-beta-3-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+
+ <configuration>
+ <version>1.0.0</version>
+ <model>src/main/mdo/paramdoc.mdo</model>
+ <packageWithVersion>false</packageWithVersion>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>base</id>
+ <goals>
+ <goal>xpp3-writer</goal>
+ <goal>java</goal>
+ <goal>xpp3-reader</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>xsd</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>xsd</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo?rev=293410&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo (added)
+++ maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo Mon Oct 3 11:06:00 2005
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+
+<model>
+ <id>paramdoc</id>
+ <name>Paramdoc</name>
+ <description><![CDATA[Documentation on parameter expressions supported by Maven for use in plugins.]]></description>
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.usability.plugin</value>
+ </default>
+ </defaults>
+ <classes>
+ <class rootElement="true" xml.tagName="paramdoc">
+ <version>1.0.0</version>
+ <name>ExpressionDocumentation</name>
+ <description>The root of a parameter plugin expression document.</description>
+ <fields>
+ <field>
+ <version>1.0.0</version>
+ <name>expressions</name>
+ <description>The list of plugin parameter expressions described by this
+ document.</description>
+ <association>
+ <type>Expression</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.0.0</version>
+ <code><![CDATA[ private Map expressionsBySyntax;
+
+ public Map getExpressionsBySyntax()
+ {
+ if ( expressionsBySyntax == null )
+ {
+ expressionsBySyntax = new HashMap();
+
+ List expressions = getExpressions();
+
+ if ( expressions != null && !expressions.isEmpty() )
+ {
+ for ( Iterator it = expressions.iterator(); it.hasNext(); )
+ {
+ Expression expr = (Expression) it.next();
+
+ expressionsBySyntax.put( expr.getSyntax(), expr );
+ }
+ }
+ }
+
+ return expressionsBySyntax;
+ }
+
+ public void flushExpressionsBySyntax()
+ {
+ expressionsBySyntax = null;
+ }
+]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ <class>
+ <version>1.0.0</version>
+ <name>Expression</name>
+ <description>A plugin parameter expression supported by Maven</description>
+ <fields>
+ <field>
+ <version>1.0.0</version>
+ <name>syntax</name>
+ <description>The syntax of the expression</description>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>description</name>
+ <description>The description of what this expression references, and what it's generally used for.</description>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>configuration</name>
+ <description>The place and syntax used to change the value of this expression.</description>
+ <type>String</type>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>cliOptions</name>
+ <description>The command-line switches used to change the value of this expression.</description>
+ <type>Properties</type>
+ <association xml.mapStyle="explode">
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>apiMethods</name>
+ <description>The programmatic methods used to change the value of this expression.</description>
+ <type>Properties</type>
+ <association xml.mapStyle="explode">
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>deprecation</name>
+ <description>A preferred alternative to this expression, in the case where it's deprecated.</description>
+ <type>String</type>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>ban</name>
+ <description>A preferred alternative to this expression, in the case where it's banned from use.</description>
+ <type>String</type>
+ </field>
+ <field>
+ <version>1.0.0</version>
+ <name>editable</name>
+ <description>Whether the value of this expression can be changed.</description>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ </field>
+ </fields>
+ </class>
+ </classes>
+</model>
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/src/main/mdo/paramdoc.mdo
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java?rev=293410&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java (added)
+++ maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java Mon Oct 3 11:06:00 2005
@@ -0,0 +1,41 @@
+package org.apache.maven.usability.plugin;
+
+import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+public class Xpp3ParseTest
+ extends TestCase
+{
+
+ public void testParse() throws IOException, XmlPullParserException
+ {
+ InputStream testDocStream = getClass().getClassLoader().getResourceAsStream( "test.paramdoc.xml" );
+ ParamdocXpp3Reader reader = new ParamdocXpp3Reader();
+
+ ExpressionDocumentation documentation = reader.read(new InputStreamReader( testDocStream ) );
+
+ Map exprs = documentation.getExpressionsBySyntax();
+
+ Expression expr = (Expression) exprs.get( "localRepository" );
+
+ assertNotNull( expr );
+
+ Properties p = expr.getCliOptions();
+
+ assertNotNull( p );
+
+ assertEquals( 1, p.size() );
+
+ assertEquals( "Override the local repository location on a per-build basis.", p.getProperty( "-Dmaven.repo.local=/path/to/local/repo" ) );
+
+ }
+
+}
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml?rev=293410&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml (added)
+++ maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml Mon Oct 3 11:06:00 2005
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<paramdoc xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ../../../../../../../maven-plugin-parameter-documenter/target/generated-site/xsd/paramdoc-1.0.0.xsd ">
+ <expressions>
+ <expression>
+ <syntax>localRepository</syntax>
+ <configuration>
+ <![CDATA[
+ Inside ~/.m2/settings.xml:
+
+ <localRepository>/path/to/local/repository</localRepository>
+ ]]></configuration>
+ <description>The ArtifactRepository instance referencing the local artifact
+ repository.</description>
+ <cliOptions>
+ <cliOption>
+ <key>-Dmaven.repo.local=/path/to/local/repo</key>
+ <value>Override the local repository location on a per-build basis.</value>
+ </cliOption>
+ </cliOptions>
+ </expression>
+ <expression>
+ <syntax>reactorProjects</syntax>
+ <description>This is the current list of projects being built by
+ Maven.</description>
+ </expression>
+ </expressions>
+</paramdoc>
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-plugin-parameter-documenter/src/test/resources/test.paramdoc.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java?rev=293410&r1=293409&r2=293410&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java Mon Oct 3 11:06:00 2005
@@ -131,15 +131,15 @@
if ( pluginPrefix != null )
{
- try
- {
+// try
+// {
descriptor = pluginManager.getPluginDescriptorForPrefix( pluginPrefix );
- }
- catch ( PluginManagerException e )
- {
- throw new MojoExecutionException( "Error retrieving plugin descriptor for prefix: \'" + pluginPrefix
- + "\'.", e );
- }
+// }
+// catch ( PluginManagerException e )
+// {
+// throw new MojoExecutionException( "Error retrieving plugin descriptor for prefix: \'" + pluginPrefix
+// + "\'.", e );
+// }
}
else if ( groupId != null && artifactId != null )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r293410 - in /maven/components/trunk: maven-core/
maven-core/src/main/java/org/apache/maven/plugin/ maven-core/src/main/java/org/apache/maven/usability/
maven-core/src/main/java/org/apache/maven/usability/plugin/ maven-core/src/main/resourc...
Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Sorry, slipped through. I was trying to fix some compilation errors on
my IDE...I dunno why it was complaining about that, but I meant to roll
it back.
Emmanuel Venisse wrote:
| John,
|
| Why do you do that?
|
| Emmanuel
|
|> Modified:
|>
maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
|>
|> URL:
|>
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java?rev=293410&r1=293409&r2=293410&view=diff
|>
|>
==============================================================================
|>
|> ---
|>
maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
|> (original)
|> +++
|>
maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
|> Mon Oct 3 11:06:00 2005
|> @@ -131,15 +131,15 @@
|>
|> if ( pluginPrefix != null )
|> {
|> - try
|> - {
|> +// try
|> +// {
|> descriptor =
|> pluginManager.getPluginDescriptorForPrefix( pluginPrefix );
|> - }
|> - catch ( PluginManagerException e )
|> - {
|> - throw new MojoExecutionException( "Error retrieving
|> plugin descriptor for prefix: \'" + pluginPrefix
|> - + "\'.", e );
|> - }
|> +// }
|> +// catch ( PluginManagerException e )
|> +// {
|> +// throw new MojoExecutionException( "Error retrieving
|> plugin descriptor for prefix: \'" + pluginPrefix
|> +// + "\'.", e );
|> +// }
|> }
|> else if ( groupId != null && artifactId != null )
|> {
|>
|>
|>
|> ---------------------------------------------------------------------
|> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
|> For additional commands, e-mail: dev-help@maven.apache.org
|>
|>
|>
|>
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
| For additional commands, e-mail: dev-help@maven.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFDQYcoK3h2CZwO/4URAvZxAJwNfRPxCTSwL+NpCz0iNKq7KzgClACdHd+L
xLszmI099k7pxSbzogb4JyE=
=jB3I
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r293410 - in /maven/components/trunk: maven-core/
maven-core/src/main/java/org/apache/maven/plugin/ maven-core/src/main/java/org/apache/maven/usability/
maven-core/src/main/java/org/apache/maven/usability/plugin/ maven-core/src/main/resourc...
Posted by Emmanuel Venisse <em...@venisse.net>.
John,
Why do you do that?
Emmanuel
> Modified: maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
> URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java?rev=293410&r1=293409&r2=293410&view=diff
> ==============================================================================
> --- maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java (original)
> +++ maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java Mon Oct 3 11:06:00 2005
> @@ -131,15 +131,15 @@
>
> if ( pluginPrefix != null )
> {
> - try
> - {
> +// try
> +// {
> descriptor = pluginManager.getPluginDescriptorForPrefix( pluginPrefix );
> - }
> - catch ( PluginManagerException e )
> - {
> - throw new MojoExecutionException( "Error retrieving plugin descriptor for prefix: \'" + pluginPrefix
> - + "\'.", e );
> - }
> +// }
> +// catch ( PluginManagerException e )
> +// {
> +// throw new MojoExecutionException( "Error retrieving plugin descriptor for prefix: \'" + pluginPrefix
> +// + "\'.", e );
> +// }
> }
> else if ( groupId != null && artifactId != null )
> {
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org