Author: snicoll
Date: Wed May 30 20:40:51 2007
New Revision: 543037
URL: http://svn.apache.org/viewvc?view=rev&rev=543037
Log:
MEAR-68: Ability to add alt-dd tags to the generated application.xml
Added:
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/expected-META-INF/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/expected-META-INF/application.xml
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/pom.xml
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/RarModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java
maven/plugins/trunk/maven-ear-plugin/src/site/apt/modules.apt
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/EarMojoTest.java
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
(original)
+++
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
Wed May 30 20:40:51 2007
@@ -22,6 +22,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.ear.util.ArtifactRepository;
+import org.codehaus.plexus.util.xml.XMLWriter;
import java.util.Set;
@@ -39,6 +40,8 @@
protected static final String JAVA_MODULE = "java";
+ protected static final String ALT_DD = "alt-dd";
+
private String uri;
private Artifact artifact;
@@ -59,6 +62,8 @@
protected Boolean unpack = null;
+ protected String altDeploymentDescriptor;
+
/**
* Empty constructor to be used when the module
* is built based on the configuration.
@@ -110,10 +115,6 @@
}
}
}
- else
- {
- return;
- }
}
public Artifact getArtifact()
@@ -197,6 +198,22 @@
return bundleFileName;
}
+
+ /**
+ * The alt-dd element specifies an optional URI to the post-assembly
version
+ * of the deployment descriptor file for a particular Java EE module. The
URI
+ * must specify the full pathname of the deployment descriptor file
relative
+ * to the application's root directory.
+ *
+ * @return the alternative deployment descriptor for this module
+ *
+ * @since JavaEE 5
+ */
+ public String getAltDeploymentDescriptor()
+ {
+ return altDeploymentDescriptor;
+ }
+
/**
* Specify whether this module should be excluded or not.
*
@@ -210,6 +227,22 @@
public Boolean shouldUnpack()
{
return unpack;
+ }
+
+ /**
+ * Writes the alternative deployment descriptor if necessary.
+ * <p/>
+ * Only writes it if the descriptor is specified and version is JavaEE 5.
+ *
+ * @param writer the writer to use
+ * @param version the java EE version in use
+ */
+ protected void writeAltDeploymentDescriptor( XMLWriter writer, String
version) {
+ if (GenerateApplicationXmlMojo.VERSION_5.equals(version) &&
getAltDeploymentDescriptor() != null) {
+ writer.startElement( ALT_DD);
+ writer.writeText( getAltDeploymentDescriptor());
+ writer.endElement();
+ }
}
public String toString()
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
(original)
+++
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
Wed May 30 20:40:51 2007
@@ -78,6 +78,18 @@
public Boolean shouldUnpack();
/**
+ * The alt-dd element specifies an optional URI to the post-assembly
version
+ * of the deployment descriptor file for a particular Java EE module. The
URI
+ * must specify the full pathname of the deployment descriptor file
relative
+ * to the application's root directory.
+ *
+ * @return the alternative deployment descriptor for this module
+ *
+ * @since JavaEE 5
+ */
+ public String getAltDeploymentDescriptor();
+
+ /**
* Appends the <tt>XML</tt> representation of this module.
*
* @param writer the writer to use
@@ -92,6 +104,7 @@
*
* @param artifacts the project's artifacts
* @throws EarPluginException if the artifact could not be resolved
+ * @throws MojoFailureException if an unexpected error occured
*/
public void resolveArtifact( Set artifacts )
throws EarPluginException, MojoFailureException;
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbModule.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbModule.java?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbModule.java
(original)
+++
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbModule.java
Wed May 30 20:40:51 2007
@@ -48,6 +48,9 @@
writer.startElement( EJB_MODULE );
writer.writeText( getUri() );
writer.endElement();
+
+ writeAltDeploymentDescriptor( writer, version);
+
writer.endElement();
}
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
(original)
+++
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
Wed May 30 20:40:51 2007
@@ -66,6 +66,9 @@
writer.startElement( JAVA_MODULE );
writer.writeText( getUri() );
writer.endElement();
+
+ writeAltDeploymentDescriptor( writer, version);
+
writer.endElement();
}
}
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/RarModule.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/RarModule.java?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/RarModule.java
(original)
+++
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/RarModule.java
Wed May 30 20:40:51 2007
@@ -48,6 +48,9 @@
writer.startElement( RAR_MODULE );
writer.writeText( getUri() );
writer.endElement();
+
+ writeAltDeploymentDescriptor( writer, version);
+
writer.endElement();
}
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java
(original)
+++
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java
Wed May 30 20:40:51 2007
@@ -65,6 +65,9 @@
writer.endElement(); // context-root
writer.endElement(); // web
+
+ writeAltDeploymentDescriptor( writer, version);
+
writer.endElement(); // module
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/site/apt/modules.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/site/apt/modules.apt?view=diff&rev=543037&r1=543036&r2=543037
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/site/apt/modules.apt (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/modules.apt Wed May 30
20:40:51 2007
@@ -108,6 +108,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* {ejbClientModule} Properties
@@ -139,6 +142,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* {ejbModule} Properties
@@ -170,6 +176,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* {jarModule} Properties
@@ -201,6 +210,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* <<includeInApplicationXml>> - set to true to if you want to generate an
entry
of this module in <<<application.xml>>>. Default is false.
@@ -235,6 +247,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* {rarModule} Properties
@@ -266,6 +281,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* {sarModule} Properties
@@ -328,6 +346,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
+
* <<contextRoot>> - sets the context root of this web artifact.
@@ -360,6 +381,9 @@
* <<unpack>> - set to true to unpack this artifact into the ear archive
according
to its uri. Default is false.
+
+ * <<altDeploymentDescriptor>> - sets the alternative deployment descriptor
for
+ this module. (Java EE5).
* {harModule} Properties
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=543037&r1=543036&r2=543037
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt Wed May 30
20:40:51 2007
@@ -108,4 +108,6 @@
* project-039: builds an EAR with a Jboss 4 configuration specifying the
loader repository to use
+ * project-040: builds an EAR with deployment descriptor configuration for
Java EE 5 and an alternative deployment descriptor
+
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=543037&r1=543036&r2=543037
==============================================================================
---
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
Wed May 30 20:40:51 2007
@@ -421,4 +421,14 @@
doTestProject( "project-039", new String[]{"ejb-sample-one-1.0.jar",
"ejb-sample-two-1.0.jar"} );
}
+ /**
+ * Builds an EAR with deployment descriptor configuration for Java EE 5 and
+ * an alternative deployment descriptor.
+ */
+ public void testProject040()
+ throws Exception
+ {
+ doTestProject( "project-040", new String[]{"ejb-sample-one-1.0.jar"} );
+ }
+
}
Added:
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/expected-META-INF/application.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/expected-META-INF/application.xml?view=auto&rev=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/expected-META-INF/application.xml
(added)
+++
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/expected-META-INF/application.xml
Wed May 30 20:40:51 2007
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<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">
+ <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>
+ <alt-dd>sample-one-ejb-jar.xml</alt-dd>
+ </module>
+</application>
\ No newline at end of file
Added:
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/pom.xml?view=auto&rev=543037
==============================================================================
---
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/pom.xml
(added)
+++
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-040/pom.xml
Wed May 30 20:40:51 2007
@@ -0,0 +1,61 @@
+<?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-040</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>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <displayName>Sample test application #008</displayName>
+ <description>
+ The purpose of this application is to test the ApplicationXmlMojo
execution with
+ custom settings.
+ </description>
+ <encoding>UTF-8</encoding>
+ <version>5</version>
+ <modules>
+ <ejbModule>
+ <groupId>eartest</groupId>
+ <artifactId>ejb-sample-one</artifactId>
+
<altDeploymentDescriptor>sample-one-ejb-jar.xml</altDeploymentDescriptor>
+ </ejbModule>
+ </modules>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>