Author: snicoll Date: Sat Apr 25 04:17:51 2009 New Revision: 768470 URL: http://svn.apache.org/viewvc?rev=768470&view=rev Log: MEAR-104: Fixed order of elements in jboss-app.xml to match the DTD
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/application.xml maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/jboss-app.xml maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/pom.xml Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.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/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java?rev=768470&r1=768469&r2=768470&view=diff ============================================================================== --- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java (original) +++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java Sat Apr 25 04:17:51 2009 @@ -80,28 +80,14 @@ } writer.startElement( JBOSS_APP_ELEMENT ); - // If JBoss 4.2 or 5.0, write the JBoss 4.2 and JBoss 5.0-compatible stuff - if ( jbossConfiguration.isJbossFourDotTwoOrHigher() ) - { - // library-directory - if ( jbossConfiguration.getLibraryDirectory() != null ) - { - writer.startElement( JbossConfiguration.LIBRARY_DIRECTORY ); - writer.writeText( jbossConfiguration.getLibraryDirectory() ); - writer.endElement(); - } - } + // Make sure to write the things in the right order so that the DTD validates - // If JBoss 4.2+, write the jboss4.2+ specific stuff - if ( jbossConfiguration.isJbossFourDotTwoOrHigher() ) + // module-order (only available as from 4.2) + if ( jbossConfiguration.isJbossFourDotTwoOrHigher() && jbossConfiguration.getModuleOrder() != null ) { - // module-order (only available in 4.2 and 4.3) - if ( jbossConfiguration.getModuleOrder() != null ) - { - writer.startElement( JbossConfiguration.MODULE_ORDER ); - writer.writeText( jbossConfiguration.getModuleOrder() ); - writer.endElement(); - } + writer.startElement( JbossConfiguration.MODULE_ORDER ); + writer.writeText( jbossConfiguration.getModuleOrder() ); + writer.endElement(); } // If JBoss 4, write the jboss4 specific stuff @@ -166,6 +152,16 @@ writer.endElement(); } + // library-directory (only available as from 4.2) + if ( jbossConfiguration.isJbossFourDotTwoOrHigher() && jbossConfiguration.getLibraryDirectory() != null ) + { + writer.startElement( JbossConfiguration.LIBRARY_DIRECTORY ); + writer.writeText( jbossConfiguration.getLibraryDirectory() ); + writer.endElement(); + } + + // Modules + List dataSources = jbossConfiguration.getDataSources(); // Write out data source modules first if ( dataSources != null ) 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=768470&r1=768469&r2=768470&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 Apr 25 04:17:51 2009 @@ -140,4 +140,8 @@ * project-055: builds an EAR with jar dependencies added in application.xml + * project-056: builds an EAR with deployment descriptor configuration for J2EE 1.4 and an alternative deployment descriptor + + * project-057: builds an EAR with a complete JBoss 4.2 configuration and validate it matches the DTD (MEAR-104) + \ No newline at end of file Modified: maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.apt?rev=768470&r1=768469&r2=768470&view=diff ============================================================================== --- maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.apt (original) +++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.apt Sat Apr 25 04:17:51 2009 @@ -167,7 +167,7 @@ * <<jmx-name>>: the object name of the ear mbean. - * <<module-order>>: specify the order in which the modules specified in the application.xml file gets loaded (JBoss 4.2 only) + * <<module-order>>: specify the order in which the modules specified in the application.xml file gets loaded (JBoss 4.2+ only) * <<data-sources>>: specify the desired data source(s) to add into the jboss-app.xml, usage is as follows: 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=768470&r1=768469&r2=768470&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 Apr 25 04:17:51 2009 @@ -605,4 +605,15 @@ { doTestProject( "project-056", new String[]{"ejb-sample-one-1.0.jar"} ); } + + + /** + * Builds an EAR with a complete JBoss 4.2 configuration and validate it + * matches the DTD (MEAR-104). + */ + public void testProject057() + throws Exception + { + doTestProject( "project-057", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} ); + } } Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/application.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/application.xml?rev=768470&view=auto ============================================================================== --- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/application.xml (added) +++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/application.xml Sat Apr 25 04:17:51 2009 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +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 +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<!DOCTYPE application PUBLIC + "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" + "http://java.sun.com/dtd/application_1_3.dtd"> +<application> + <display-name>maven-ear-plugin-test-project-057</display-name> + <module> + <ejb>ejb-sample-one-1.0.jar</ejb> + </module> + <module> + <ejb>ejb-sample-two-1.0.jar</ejb> + </module> +</application> \ No newline at end of file Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/jboss-app.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/jboss-app.xml?rev=768470&view=auto ============================================================================== --- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/jboss-app.xml (added) +++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/expected-META-INF/jboss-app.xml Sat Apr 25 04:17:51 2009 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +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 +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<!DOCTYPE jboss-app PUBLIC + "-//JBoss//DTD J2EE Application 1.4//EN" + "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd"> +<jboss-app> + <module-order>strict</module-order> + <loader-repository>com.foo:loader=project-057.ear<loader-repository-config>java2ParentDelegation=true</loader-repository-config> + </loader-repository> + <library-directory>APP-INF/lib</library-directory> +</jboss-app> \ No newline at end of file Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/pom.xml?rev=768470&view=auto ============================================================================== --- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/pom.xml (added) +++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-057/pom.xml Sat Apr 25 04:17:51 2009 @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +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 +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + 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-057</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>ear</packaging> + <dependencies> + <dependency> + <groupId>eartest</groupId> + <artifactId>ejb-sample-one</artifactId> + <version>1.0</version> + <type>ejb</type> + </dependency> + <dependency> + <groupId>eartest</groupId> + <artifactId>ejb-sample-two</artifactId> + <version>1.0</version> + <type>ejb</type> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ear-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <jboss> + <version>4.2</version> + <module-order>strict</module-order> + <library-directory>APP-INF/lib</library-directory> + <loader-repository> + com.foo:loader=project-057.ear + </loader-repository> + <loader-repository-config> + java2ParentDelegation=true + </loader-repository-config> + <module-order>strict</module-order> + </jboss> + </configuration> + </plugin> + </plugins> + </build> +</project>