You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/06/24 13:49:21 UTC

svn commit: r1353251 - /maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java

Author: hboutemy
Date: Sun Jun 24 11:49:20 2012
New Revision: 1353251

URL: http://svn.apache.org/viewvc?rev=1353251&view=rev
Log:
[MPLUGIN-215] don't generate content with empty value, due to default values defined for annotations

Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=1353251&r1=1353250&r2=1353251&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java Sun Jun 24 11:49:20 2012
@@ -258,7 +258,7 @@ public class PluginDescriptorGenerator
         //
         // ----------------------------------------------------------------------
 
-        if ( mojoDescriptor.isDependencyResolutionRequired() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.isDependencyResolutionRequired() ) )
         {
             GeneratorUtils.element( w, "requiresDependencyResolution", mojoDescriptor.isDependencyResolutionRequired() );
         }
@@ -303,7 +303,7 @@ public class PluginDescriptorGenerator
         //
         // ----------------------------------------------------------------------
 
-        if ( mojoDescriptor.getPhase() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.getPhase() ) )
         {
             GeneratorUtils.element( w, "phase", mojoDescriptor.getPhase() );
         }
@@ -312,17 +312,17 @@ public class PluginDescriptorGenerator
         //
         // ----------------------------------------------------------------------
 
-        if ( mojoDescriptor.getExecutePhase() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) )
         {
             GeneratorUtils.element( w, "executePhase", mojoDescriptor.getExecutePhase() );
         }
 
-        if ( mojoDescriptor.getExecuteGoal() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.getExecuteGoal() ) )
         {
             GeneratorUtils.element( w, "executeGoal", mojoDescriptor.getExecuteGoal() );
         }
 
-        if ( mojoDescriptor.getExecuteLifecycle() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.getExecuteLifecycle() ) )
         {
             GeneratorUtils.element( w, "executeLifecycle", mojoDescriptor.getExecuteLifecycle() );
         }
@@ -347,7 +347,7 @@ public class PluginDescriptorGenerator
         //
         // ----------------------------------------------------------------------
 
-        if ( mojoDescriptor.getComponentConfigurator() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.getComponentConfigurator() ) )
         {
             w.startElement( "configurator" );
             w.writeText( mojoDescriptor.getComponentConfigurator() );
@@ -358,7 +358,7 @@ public class PluginDescriptorGenerator
         //
         // ----------------------------------------------------------------------
 
-        if ( mojoDescriptor.getComponentComposer() != null )
+        if ( StringUtils.isNotEmpty( mojoDescriptor.getComponentComposer() ) )
         {
             w.startElement( "composer" );
             w.writeText( mojoDescriptor.getComponentComposer() );
@@ -571,7 +571,7 @@ public class PluginDescriptorGenerator
                 w.startElement( parameter.getName() );
 
                 String type = parameter.getType();
-                if ( type != null )
+                if ( StringUtils.isNotEmpty( type ) )
                 {
                     w.addAttribute( "implementation", type );
                 }
@@ -581,7 +581,7 @@ public class PluginDescriptorGenerator
                     w.addAttribute( "default-value", parameter.getDefaultValue() );
                 }
 
-                if ( parameter.getExpression() != null )
+                if ( StringUtils.isNotEmpty( parameter.getExpression() ) )
                 {
                     w.writeText( parameter.getExpression() );
                 }
@@ -609,7 +609,7 @@ public class PluginDescriptorGenerator
 
                 GeneratorUtils.element( w, "role", requirement.getRole() );
 
-                if ( requirement.getRoleHint() != null )
+                if ( StringUtils.isNotEmpty( requirement.getRoleHint() ) )
                 {
                     GeneratorUtils.element( w, "role-hint", requirement.getRoleHint() );
                 }