Skip to content

Commit

Permalink
[MPLUGIN-469] Omit empty line in generated help goal output if plugin…
Browse files Browse the repository at this point in the history
… description is empty
  • Loading branch information
michael-o committed May 12, 2023
1 parent ee9b35d commit bf04d07
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ help-deprecated-annotation-only:test
Parameter description in javadoc.

undocumentedParam

Required: Yes
User property: test.undocumented
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ help-jdk11:test
This parameter is deprecated.

undocumentedParam

Required: Yes
User property: test.undocumented
1 change: 0 additions & 1 deletion maven-plugin-plugin/src/it/help-basic/expected-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ help:test
This parameter is deprecated.

undocumentedParam

Required: Yes
User property: test.undocumented
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -449,7 +451,7 @@ public class HelpMojo
}
return level;
}

private static String getPropertyFromExpression( String expression )
{
if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -58,47 +58,47 @@ 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;

/**
* 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;

/**
* 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;
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -478,7 +480,7 @@ public class HelpMojo
}
return level;
}

private static String getPropertyFromExpression( String expression )
{
if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" )
Expand Down

0 comments on commit bf04d07

Please sign in to comment.