mirror of https://github.com/apache/maven.git
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@216275 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0cc696a407
commit
133d3c9330
|
@ -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" );
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue