You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:33:21 UTC
[maven-ear-plugin] 04/45: Applying patch(es) for: MNG-576
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to annotated tag maven-ear-plugin-2.0
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit cc3bb8e6bbb78e572195af251c37ee47effe726b
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Wed Jul 13 22:08:02 2005 +0000
Applying patch(es) for: MNG-576
One change:
o Applied lifecycle mapping patch to a new file in src/main/resources of the ear plugin project, to create META-INF/plexus/components.xml with the custom lifecycle mapping.
This plugin needs an integration test.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk/maven-plugins/maven-ear-plugin@216275 13f79535-47bb-0310-9956-ffa450edef68
---
.../plugin/ear/GenerateApplicationXmlMojo.java | 24 ++++++++++++++++++----
src/main/resources/META-INF/plexus/components.xml | 19 +++++++++++++++++
2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java b/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
index a9c7a5d..36318ae 100644
--- a/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
@@ -28,7 +28,7 @@ import java.io.IOException;
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id $
* @goal generate-application-xml
- * @phase process-resources
+ * @phase generate-resources
* @requiresDependencyResolution test
* @description generates the application.xml deployment descriptor
*/
@@ -42,11 +42,19 @@ public class GenerateApplicationXmlMojo
public static final String UTF_8 = "UTF-8";
+
+ /**
+ * Whether the application.xml should be generated or not.
+ *
+ * @parameter
+ */
+ private Boolean generateApplicationXml = Boolean.TRUE;
+
/**
* The version of the application.xml to generate. Valid values
* are 1.3 and 1.4.
*
- * @parameter expression="${maven.ear.appxml.version}"
+ * @parameter
*/
private String version = VERSION_1_3;
@@ -62,7 +70,7 @@ public class GenerateApplicationXmlMojo
* Description of the application to be used when application.xml
* file is autogenerated.
*
- * @parameter
+ * @parameter expression="${project.description}"
*/
private String description = null;
@@ -84,18 +92,26 @@ public class GenerateApplicationXmlMojo
throws MojoExecutionException
{
getLog().debug( " ======= GenerateApplicationXmlMojo settings =======" );
+ getLog().debug( "generateApplicationXml[" + generateApplicationXml + "]" );
getLog().debug( "version[" + version + "]" );
getLog().debug( "displayName[" + displayName + "]" );
getLog().debug( "description[" + description + "]" );
getLog().debug( "encoding[" + encoding + "]" );
getLog().debug( "generatedDescriptorLocation[" + generatedDescriptorLocation + "]" );
+ if ( !generateApplicationXml.booleanValue() )
+ {
+ getLog().debug( "Generation of application.xml is disabled" );
+ return;
+ }
+
+ // Check version
if ( !version.equals( VERSION_1_3 ) && !version.equals( VERSION_1_4 ) )
{
throw new MojoExecutionException( "Invalid version[" + version + "]" );
}
- // Generate deployment descriptor
+ // Generate deployment descriptor and copy it to the build directory
try
{
getLog().info( "Generating application.xml" );
diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000..84d391b
--- /dev/null
+++ b/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,19 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>ear</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <!-- START SNIPPET: ear-lifecycle -->
+ <phases>
+ <generate-resources>ear:generate-application-xml</generate-resources>
+ <package>ear:ear</package>
+ <install>install:install</install>
+ <deploy>deploy:deploy</deploy>
+ </phases>
+ <!-- END SNIPPET: ear-lifecycle -->
+ </configuration>
+ </component>
+ </components>
+</component-set>
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.