You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2007/07/12 22:59:46 UTC
svn commit: r555758 - in /maven/plugins/trunk/maven-ear-plugin/src:
main/java/org/apache/maven/plugin/ear/ site/apt/
test/java/org/apache/maven/plugin/ear/ test/resources/projects/project-041/
test/resources/projects/project-041/expected-META-INF/
Author: snicoll
Date: Thu Jul 12 13:59:45 2007
New Revision: 555758
URL: http://svn.apache.org/viewvc?view=rev&rev=555758
Log:
MEAR-72: Added JBoss module-order element (JBoss 4.2 only)
Submitted by: Sairam Rekapalli
Reviewed by: Stephane Nicoll
Added:
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/application.xml
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/jboss-app.xml
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/pom.xml
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.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/EarMojoTest.java
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java?view=diff&rev=555758&r1=555757&r2=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java Thu Jul 12 13:59:45 2007
@@ -160,7 +160,8 @@
}
getLog().debug( "Initializing ear execution context" );
- EarExecutionContext.getInstance().initialize( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMapping );
+ EarExecutionContext.getInstance().initialize( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration,
+ fileNameMapping );
getLog().debug( "Resolving ear modules ..." );
allModules = new ArrayList();
@@ -291,9 +292,9 @@
jboss.getChild( JbossConfiguration.UNAUHTHENTICTED_PRINCIPAL ).getValue();
final String loaderRepository = jboss.getChild( JbossConfiguration.LOADER_REPOSITORY ).getValue();
final String jmxName = jboss.getChild( JbossConfiguration.JMX_NAME ).getValue();
-
- jbossConfiguration =
- new JbossConfiguration( version, securityDomain, unauthenticatedPrincipal, jmxName, loaderRepository );
+ final String moduleOrder = jboss.getChild( JbossConfiguration.MODULE_ORDER ).getValue();
+ jbossConfiguration = new JbossConfiguration( version, securityDomain, unauthenticatedPrincipal, jmxName,
+ loaderRepository, moduleOrder );
}
catch ( PlexusConfigurationException e )
{
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?view=diff&rev=555758&r1=555757&r2=555758
==============================================================================
--- 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 Thu Jul 12 13:59:45 2007
@@ -43,9 +43,10 @@
public static final String DOCTYPE_4 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.4//EN\"\n" +
"\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd\"";
- private static final String JBOSS_APP_ELEMENT = "jboss-app";
+ public static final String DOCTYPE_4_2 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.4//EN\"\n" +
+ "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd\"";
- private static final String MODULE_ELEMENT = "module";
+ private static final String JBOSS_APP_ELEMENT = "jboss-app";
JbossAppXmlWriter( String encoding )
{
@@ -57,19 +58,35 @@
{
final Writer w = initializeWriter( destinationFile );
- XMLWriter writer = null;
+ XMLWriter writer;
if ( jbossConfiguration.isJbossThreeDotTwo() )
{
writer = initializeXmlWriter( w, DOCTYPE_3_2 );
}
- else
+ else if ( jbossConfiguration.isJbossFour() )
{
writer = initializeXmlWriter( w, DOCTYPE_4 );
}
+ else
+ {
+ writer = initializeXmlWriter( w, DOCTYPE_4_2 );
+ }
writer.startElement( JBOSS_APP_ELEMENT );
+ // If JBoss 4.2, write the jboss4.2 specific stuff
+ if ( jbossConfiguration.isJbossFourDotTwo() )
+ {
+ // module-order
+ if ( jbossConfiguration.getModuleOrder() != null )
+ {
+ writer.startElement( JbossConfiguration.MODULE_ORDER );
+ writer.writeText( jbossConfiguration.getModuleOrder() );
+ writer.endElement();
+ }
+ }
+
// If JBoss 4, write the jboss4 specific stuff
- if ( jbossConfiguration.isJbossFour() )
+ if ( jbossConfiguration.isJbossFour() || jbossConfiguration.isJbossFourDotTwo() )
{
if ( jbossConfiguration.getSecurityDomain() != null )
{
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java?view=diff&rev=555758&r1=555757&r2=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java Thu Jul 12 13:59:45 2007
@@ -33,6 +33,8 @@
static final String VERSION_4 = "4";
+ static final String VERSION_4_2 = "4.2";
+
static final String VERSION = "version";
static final String SECURITY_DOMAIN = "security-domain";
@@ -43,6 +45,8 @@
static final String LOADER_REPOSITORY = "loader-repository";
+ static final String MODULE_ORDER = "module-order";
+
private final String version;
@@ -50,6 +54,8 @@
private boolean jbossFour;
+ private boolean jbossFourDotTwo;
+
private final String securityDomain;
private final String unauthenticatedPrincipal;
@@ -58,9 +64,11 @@
private final String loaderRepository;
+ private final String moduleOrder;
+
public JbossConfiguration( String version, String securityDomain, String unauthenticatedPrincipal, String jmxName,
- String loaderRepository )
+ String loaderRepository, String moduleOrder )
throws EarPluginException
{
if ( version == null )
@@ -78,6 +86,10 @@
{
this.jbossFour = true;
}
+ else if ( version.equals( JbossConfiguration.VERSION_4_2 ) )
+ {
+ this.jbossFourDotTwo = true;
+ }
else
{
throw new EarPluginException(
@@ -87,6 +99,7 @@
this.unauthenticatedPrincipal = unauthenticatedPrincipal;
this.jmxName = jmxName;
this.loaderRepository = loaderRepository;
+ this.moduleOrder = moduleOrder;
}
}
@@ -120,6 +133,17 @@
return jbossFour;
}
+
+ /**
+ * Returns true if the targeted JBoss version is 4.2.
+ *
+ * @return if the targeted version is 4.2
+ */
+ public boolean isJbossFourDotTwo()
+ {
+ return jbossFourDotTwo;
+ }
+
/**
* The security-domain element specifies the JNDI name of the security
* manager that implements the EJBSecurityManager and RealmMapping for
@@ -180,4 +204,29 @@
{
return loaderRepository;
}
+
+ /**
+ * The module-order specifies the order in which the modules specified
+ * in the application.xml file gets loaded. Allowed values are:
+ * <p/>
+ * <module-order>strict</module-order>
+ * The strict value indicates that the deployments of the modules will
+ * be done in the order that would be specified in the application.xml
+ * and jboss-app.xml file.
+ * <p/>
+ * <module-order>implicit</module-order>
+ * The implicit value indicates the deployment would follow the order
+ * which would be specified in the DeploymentSorter.
+ * <p/>
+ * Returns <tt>null</tt> if no module order is set.
+ * <p/>
+ * Only available as from JBoss 4.2.
+ *
+ * @return the module order
+ */
+ public String getModuleOrder()
+ {
+ return moduleOrder;
+ }
+
}
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?view=diff&rev=555758&r1=555757&r2=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt Thu Jul 12 13:59:45 2007
@@ -110,4 +110,6 @@
* project-040: builds an EAR with deployment descriptor configuration for Java EE 5 and an alternative deployment descriptor
+ * project-041: builds an EAR with a Jboss 4.2 configuration specifying the module order to use
+
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?view=diff&rev=555758&r1=555757&r2=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.apt (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/usage.apt Thu Jul 12 13:59:45 2007
@@ -116,7 +116,7 @@
The EAR plugin can generate the jboss-app.xml automatically. To do so, the 'jboss'
element must be configured and takes the following child elements:
- * <<version>>: the targeted JBoss version to use (3.2 or 4 which is the default).
+ * <<version>>: the targeted JBoss version to use, 3.2, 4 or 4.2 (the default is 4).
* <<security-domain>>: the JNDI name of the security manager (JBoss 4 only)
@@ -125,6 +125,9 @@
* <<loader-repository>>: the name of the UnifiedLoaderRepository MBean to use for the ear to provide ear level scoping of classes deployed in the ear
* <<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)
+
Hibernate archives (HAR) and Service archives (SAR) will be recognized automatically
Modified: maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/EarMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/EarMojoTest.java?view=diff&rev=555758&r1=555757&r2=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/EarMojoTest.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/EarMojoTest.java Thu Jul 12 13:59:45 2007
@@ -431,4 +431,13 @@
doTestProject( "project-040", new String[]{"ejb-sample-one-1.0.jar"} );
}
+ /**
+ * Builds an EAR with a Jboss 4.2 configuration specifying the module order to use.
+ */
+ public void testProject041()
+ throws Exception
+ {
+ doTestProject( "project-041", 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-041/expected-META-INF/application.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/application.xml?view=auto&rev=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/application.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/application.xml Thu Jul 12 13:59:45 2007
@@ -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-041</display-name>
+ <module>
+ <ejb>ejb-sample-two-1.0.jar</ejb>
+ </module>
+ <module>
+ <ejb>ejb-sample-one-1.0.jar</ejb>
+ </module>
+</application>
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/jboss-app.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/jboss-app.xml?view=auto&rev=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/jboss-app.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/expected-META-INF/jboss-app.xml Thu Jul 12 13:59:45 2007
@@ -0,0 +1,26 @@
+<?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>
+</jboss-app>
\ No newline at end of file
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/pom.xml?view=auto&rev=555758
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/pom.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-041/pom.xml Thu Jul 12 13:59:45 2007
@@ -0,0 +1,57 @@
+<?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-041</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>
+ <configuration>
+ <jboss>
+ <version>4.2</version>
+ <module-order>strict</module-order>
+ </jboss>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>