diff --git a/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java b/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java index 9f1e2a377d..b2c8ac85d0 100644 --- a/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java +++ b/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java @@ -70,24 +70,14 @@ public final class ApplicationXmlWriter if ( GenerateApplicationXmlMojo.VERSION_1_3.equals( version ) ) { writer = initializeRootElementOneDotThree( w ); + writeDisplayName(displayName, writer); + writeDescription(description, writer); } else if ( GenerateApplicationXmlMojo.VERSION_1_4.equals( version ) ) { writer = initializeRootElementOneDotFour( w ); - } - - if ( description != null ) - { - writer.startElement( "description" ); - writer.writeText( description ); - writer.endElement(); - } - - if ( displayName != null ) - { - writer.startElement( "display-name" ); - writer.writeText( displayName ); - writer.endElement(); + writeDescription(description, writer); + writeDisplayName(displayName, writer); } Iterator i = earModules.iterator(); @@ -101,6 +91,26 @@ public final class ApplicationXmlWriter close( w ); } + private void writeDescription(String description, XMLWriter writer) + { + if ( description != null ) + { + writer.startElement( "description" ); + writer.writeText( description ); + writer.endElement(); + } + } + + private void writeDisplayName(String displayName, XMLWriter writer) + { + if ( displayName != null ) + { + writer.startElement( "display-name" ); + writer.writeText( displayName ); + writer.endElement(); + } + } + private void close( Writer closeable ) { if ( closeable == null )