Author: snicoll
Date: Sat Jan 16 14:53:20 2010
New Revision: 899968

URL: http://svn.apache.org/viewvc?rev=899968&view=rev
Log:
MEAR-118: Fixed regression of application.xml generation.

Added:
    
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/
    
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/expected-META-INF/
    
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/expected-META-INF/application.xml
      - copied, changed from r899895, 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/expected-META-INF/application.xml
    
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/pom.xml
      - copied, changed from r899895, 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/pom.xml
Modified:
    maven/plugins/trunk/maven-ear-plugin/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
    maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt
    
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java

Modified: maven/plugins/trunk/maven-ear-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/pom.xml?rev=899968&r1=899967&r2=899968&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/pom.xml Sat Jan 16 14:53:20 2010
@@ -29,7 +29,7 @@
   </parent>
 
   <artifactId>maven-ear-plugin</artifactId>
-  <version>2.5-SNAPSHOT</version>
+  <version>2.4.1-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Maven EAR Plugin</name>

Modified: 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java?rev=899968&r1=899967&r2=899968&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
 Sat Jan 16 14:53:20 2010
@@ -34,9 +34,9 @@
 final class ApplicationXmlWriter
     extends AbstractXmlWriter
 {
-    public static final String DOCTYPE_1_3 = "application PUBLIC\n" +
-        "\t\"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN\"\n" +
-        "\t\"http://java.sun.com/dtd/application_1_3.dtd\"";;
+    public static final String DOCTYPE_1_3 =
+        "application PUBLIC\n" + "\t\"-//Sun Microsystems, Inc.//DTD J2EE 
Application 1.3//EN\"\n" +
+            "\t\"http://java.sun.com/dtd/application_1_3.dtd\"";;
 
     private static final String APPLICATION_ELEMENT = "application";
 
@@ -67,12 +67,25 @@
         {
             writer = initializeRootElementFive( w );
         }
-        else if ( GenerateApplicationXmlMojo.VERSION_6.equals( version ))
+        else if ( GenerateApplicationXmlMojo.VERSION_6.equals( version ) )
         {
             writer = initializeRootElementSix( w );
         }
-        writeDisplayName( context.getDisplayName(), writer );
-        writeDescription( context.getDescription(), writer );
+
+        // IMPORTANT: the order of the description and display-name elements 
was
+        // reversed between J2EE 1.3 and J2EE 1.4.
+        if ( GenerateApplicationXmlMojo.VERSION_1_3.equals( version ) )
+        {
+            writeDisplayName( context.getDisplayName(), writer );
+            writeDescription( context.getDescription(), writer );
+        }
+        else
+        {
+            writeDescription( context.getDescription(), writer );
+            writeDisplayName( context.getDisplayName(), writer );
+        }
+        // Do not change this unless you really know what you're doing :)
+
 
         final Iterator moduleIt = context.getEarModules().iterator();
         while ( moduleIt.hasNext() )
@@ -90,7 +103,7 @@
 
         if ( GenerateApplicationXmlMojo.VERSION_5.equals( version ) )
         {
-               writeLibraryDirectory ( context.getLibraryDirectory(), writer );
+            writeLibraryDirectory( context.getLibraryDirectory(), writer );
         }
 
         writer.endElement();
@@ -168,7 +181,6 @@
         writer.addAttribute( "xsi:schemaLocation",
                              "http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/application_6.xsd"; );
         writer.addAttribute( "version", "6" );
-        //mkleint: the schema document is not present at the site, but it 
should end up there eventually..
         return writer;
     }
 

Modified: maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt?rev=899968&r1=899967&r2=899968&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt Sat Jan 16 
14:53:20 2010
@@ -144,4 +144,7 @@
 
   * project-057: builds an EAR with a complete JBoss 4.2 configuration and 
validate it matches the DTD (MEAR-104)
 
+  * project-058: builds an EAR with deployment descriptor configuration for 
Java EE 6
+
+
    
\ No newline at end of file

Modified: 
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java?rev=899968&r1=899967&r2=899968&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
 Sat Jan 16 14:53:20 2010
@@ -616,4 +616,13 @@
     {
         doTestProject( "project-057", new String[]{"ejb-sample-one-1.0.jar", 
"ejb-sample-two-1.0.jar"} );
     }
+
+     /**
+     * Builds an EAR with deployment descriptor configuration for Java EE 6.
+     */
+    public void testProject058()
+        throws Exception
+    {
+        doTestProject( "project-058", new String[]{"ejb-sample-one-1.0.jar"} );
+    }
 }

Copied: 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/expected-META-INF/application.xml
 (from r899895, 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/expected-META-INF/application.xml)
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/expected-META-INF/application.xml?p2=maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/expected-META-INF/application.xml&p1=maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/expected-META-INF/application.xml&r1=899895&r2=899968&rev=899968&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/expected-META-INF/application.xml
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/expected-META-INF/application.xml
 Sat Jan 16 14:53:20 2010
@@ -18,11 +18,11 @@
 under the License.
 -->
 
-<application xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/application_5.xsd"; version="5">
+<application xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/application_6.xsd"; version="6">
   <description>The purpose of this application is to test the 
ApplicationXmlMojo execution with
             custom settings.</description>
   <display-name>Sample test application #008</display-name>
   <module>
     <ejb>ejb-sample-one-1.0.jar</ejb>
   </module>
-</application>
\ No newline at end of file
+</application>

Copied: 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/pom.xml
 (from r899895, 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/pom.xml)
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/pom.xml?p2=maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/pom.xml&p1=maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/pom.xml&r1=899895&r2=899968&rev=899968&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-010/pom.xml
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-058/pom.xml
 Sat Jan 16 14:53:20 2010
@@ -22,7 +22,7 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   <groupId>ear</groupId>
-  <artifactId>maven-ear-plugin-test-project-010</artifactId>
+  <artifactId>maven-ear-plugin-test-project-058</artifactId>
   <version>99.0</version>
   <name>Maven</name>
   <packaging>ear</packaging>
@@ -47,7 +47,7 @@
             custom settings.
           </description>
           <encoding>UTF-8</encoding>
-          <version>5</version>
+          <version>6</version>
         </configuration>
       </plugin>
     </plugins>


Reply via email to