From 0ac08a36fcd81d504d87e1f9808de0880ef4ab87 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 26 Jun 2012 07:03:11 +0000 Subject: [PATCH] [MPLUGIN-217] HelpMojo (always) contains description for the maven-plugin-plugin Submitted by Tony Chemit. git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1353837 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/tools/plugin/generator/PluginHelpGenerator.java | 7 +++++-- .../src/main/resources/help-class-source.vm | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java index 1299cf8..714fc1b 100644 --- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java +++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java @@ -155,7 +155,7 @@ public class PluginHelpGenerator try { writer = new OutputStreamWriter( new FileOutputStream( helpClass ), request.getEncoding() ); - writer.write( getHelpClassSources( propertiesFilePath ) ); + writer.write( getHelpClassSources( propertiesFilePath, pluginDescriptor ) ); writer.flush(); } catch ( IOException e ) @@ -189,7 +189,7 @@ public class PluginHelpGenerator // Private methods // ---------------------------------------------------------------------- - protected String getHelpClassSources( String propertiesFilePath ) + protected String getHelpClassSources( String propertiesFilePath, PluginDescriptor pluginDescriptor ) { Properties properties = new Properties(); VelocityContext context = new VelocityContext( properties ); @@ -202,6 +202,9 @@ public class PluginHelpGenerator properties.put( "helpPackageName", "" ); } properties.put( "pluginHelpPath", propertiesFilePath + "/plugin-help.xml" ); + properties.put( "artifactId", pluginDescriptor.getArtifactId()); + properties.put( "goalPrefix", pluginDescriptor.getGoalPrefix()); + // FIXME encoding ! StringWriter stringWriter = new StringWriter(); diff --git a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm index 424e8e2..3513540 100644 --- a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm +++ b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm @@ -17,8 +17,8 @@ import java.util.Iterator; import java.util.List; /** - * Display help information on maven-plugin-plugin.
- * Call mvn plugin:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. + * Display help information on ${artifactId}.
+ * Call mvn ${goalPrefix}:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. * @author * @version * @goal help