This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch fixes
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git

commit a3d44198841fa7b3fc391e22a31ed1c80f2a3c3b
Author: Michael Osipov <micha...@apache.org>
AuthorDate: Tue May 9 22:51:51 2023 +0200

    [MPLUGIN-469] Omit empty line in generated help goal output if plugin 
description is empty
---
 .../expected-help.txt                              |  1 -
 .../src/it/help-basic-jdk11/expected-help.txt      |  1 -
 .../src/it/help-basic/expected-help.txt            |  1 -
 .../src/main/resources/help-class-source-v4.vm     |  6 +++--
 .../src/main/resources/help-class-source.vm        | 30 ++++++++++++----------
 5 files changed, 20 insertions(+), 19 deletions(-)

diff --git 
a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt
 
b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt
index cfb75851..d05f112a 100644
--- 
a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt
+++ 
b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt
@@ -20,6 +20,5 @@ help-deprecated-annotation-only:test
       Parameter description in javadoc.
 
     undocumentedParam
-      
       Required: Yes
       User property: test.undocumented
diff --git a/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt 
b/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt
index 0641d084..25875a0e 100644
--- a/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt
+++ b/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt
@@ -20,6 +20,5 @@ help-jdk11:test
       This parameter is deprecated.
 
     undocumentedParam
-      
       Required: Yes
       User property: test.undocumented
diff --git a/maven-plugin-plugin/src/it/help-basic/expected-help.txt 
b/maven-plugin-plugin/src/it/help-basic/expected-help.txt
index ccc37585..68d99c2b 100644
--- a/maven-plugin-plugin/src/it/help-basic/expected-help.txt
+++ b/maven-plugin-plugin/src/it/help-basic/expected-help.txt
@@ -20,6 +20,5 @@ help:test
       This parameter is deprecated.
 
     undocumentedParam
-      
       Required: Yes
       User property: test.undocumented
diff --git 
a/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm 
b/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm
index 4b2ba508..0ac5b891 100644
--- a/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm
+++ b/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm
@@ -298,7 +298,9 @@ public class HelpMojo
             append( sb, "Deprecated. " + deprecated.getTextContent(), 3 );
             append( sb, "", 0 );
         }
-        append( sb, parameterDescription, 3 );
+        if ( isNotEmpty( parameterDescription ) ) {
+            append( sb, parameterDescription, 3 );
+        }
         if ( "true".equals( getValue( parameter, "required" ) ) )
         {
             append( sb, "Required: Yes", 3 );
@@ -449,7 +451,7 @@ public class HelpMojo
         }
         return level;
     }
-    
+
     private static String getPropertyFromExpression( String expression )
     {
         if ( expression != null && expression.startsWith( "${" ) && 
expression.endsWith( "}" )
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 06cc56e7..6c6e4a4e 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
@@ -5,9 +5,9 @@
 ## to you under the Apache License, Version 2.0 (the
 ## "License"); you may not use this file except in compliance
 ## with the License.  You may obtain a copy of the License at
-## 
+##
 ##   http://www.apache.org/licenses/LICENSE-2.0
-## 
+##
 ## Unless required by applicable law or agreed to in writing,
 ## software distributed under the License is distributed on an
 ## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -43,7 +43,7 @@ import java.util.List;
  * Display help information on ${artifactId}.<br>
  * Call <code>mvn ${goalPrefix}:help -Ddetail=true 
-Dgoal=&lt;goal-name&gt;</code> to display parameter details.
  * @author maven-plugin-tools
-#if ( !$useAnnotations )     
+#if ( !$useAnnotations )
  * @goal help
  * @requiresProject false
  * @threadSafe
@@ -58,11 +58,11 @@ public class HelpMojo
     /**
      * If <code>true</code>, display all settable properties for each goal.
      *
-#if ( !$useAnnotations )     
+#if ( !$useAnnotations )
      * @parameter property="detail" default-value="false"
 #end
      */
-#if ( $useAnnotations )     
+#if ( $useAnnotations )
     @Parameter( property = "detail", defaultValue = "false" )
 #end
     private boolean detail;
@@ -70,23 +70,23 @@ public class HelpMojo
     /**
      * The name of the goal for which to show help. If unspecified, all goals 
will be displayed.
      *
-#if ( !$useAnnotations )     
+#if ( !$useAnnotations )
      * @parameter property="goal"
 #end
      */
-#if ( $useAnnotations )     
+#if ( $useAnnotations )
     @Parameter( property = "goal" )
-#end    
+#end
     private java.lang.String goal;
 
     /**
      * The maximum length of a display line, should be positive.
      *
-#if ( !$useAnnotations )     
+#if ( !$useAnnotations )
      * @parameter property="lineLength" default-value="80"
 #end
      */
-#if ( $useAnnotations )     
+#if ( $useAnnotations )
     @Parameter( property = "lineLength", defaultValue = "80" )
 #end
     private int lineLength;
@@ -94,11 +94,11 @@ public class HelpMojo
     /**
      * The number of spaces per indentation level, should be positive.
      *
-#if ( !$useAnnotations )     
+#if ( !$useAnnotations )
      * @parameter property="indentSize" default-value="2"
 #end
      */
-#if ( $useAnnotations )     
+#if ( $useAnnotations )
     @Parameter( property = "indentSize", defaultValue = "2" )
 #end
     private int indentSize;
@@ -327,7 +327,9 @@ public class HelpMojo
             append( sb, "Deprecated. " + deprecated.getTextContent(), 3 );
             append( sb, "", 0 );
         }
-        append( sb, parameterDescription, 3 );
+        if ( isNotEmpty( parameterDescription ) ) {
+            append( sb, parameterDescription, 3 );
+        }
         if ( "true".equals( getValue( parameter, "required" ) ) )
         {
             append( sb, "Required: Yes", 3 );
@@ -478,7 +480,7 @@ public class HelpMojo
         }
         return level;
     }
-    
+
     private static String getPropertyFromExpression( String expression )
     {
         if ( expression != null && expression.startsWith( "${" ) && 
expression.endsWith( "}" )

Reply via email to