o Bumped version of plexus-container-default to 1.0-alpha-6-SNAPSHOT

o Committed changes to the EAR plugin on behalf of Stephane Nicoll,
  awaiting his commit privileges.
  Resolves MNG-621 and MNG-622.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@227088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2005-08-02 21:47:50 +00:00
parent d396f24642
commit 6508398316
16 changed files with 905 additions and 34 deletions

View File

@ -0,0 +1,226 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
import java.util.Iterator;
import java.util.Set;
/**
* A base implementation of an {@link EarModule}.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public abstract class AbstractEarModule
implements EarModule
{
protected static final String MODULE_ELEMENT = "module";
private String uri;
private Artifact artifact;
// Those are set by the configuration
private String groupId;
private String artifactId;
private String bundleDir;
private String bundleFileName;
/**
* Empty constructor to be used when the module
* is built based on the configuration.
*/
public AbstractEarModule()
{
}
/**
* Creates an ear module from the artifact.
*
* @param a the artifact
*/
public AbstractEarModule( Artifact a )
{
this.artifact = a;
this.groupId = a.getGroupId();
this.artifactId = a.getArtifactId();
this.bundleDir = null;
}
public void resolveArtifact( Set artifacts )
throws EarPluginException
{
if ( artifact != null )
{
return;
}
else
{
if ( groupId == null || artifactId == null )
{
throw new EarPluginException(
"Could not resolve artifact[" + groupId + ":" + artifactId + ":" + getType() + "]" );
}
Iterator i = artifacts.iterator();
while ( i.hasNext() )
{
Artifact a = (Artifact) i.next();
if ( a.getGroupId().equals( groupId ) && a.getArtifactId().equals( artifactId ) &&
a.getType().equals( getType() ) )
{
artifact = a;
return;
}
}
// Artifact has not been found
throw new EarPluginException( "Artifact[" + groupId + ":" + artifactId + ":" + getType() + "] " +
"is not a dependency of the project." );
}
}
/**
* Returns the type associated to the module.
*
* @return the artifact's type of the module
*/
protected abstract String getType();
public Artifact getArtifact()
{
return artifact;
}
public String getUri()
{
if ( uri == null )
{
if ( getBundleDir() == null )
{
uri = getBundleFileName();
}
else
{
uri = getBundleDir() + getBundleFileName();
}
}
return uri;
}
/**
* Returns the artifact's groupId.
*
* @return the group Id
*/
public String getGroupId()
{
return groupId;
}
/**
* Returns the artifact's Id.
*
* @return the artifact Id
*/
public String getArtifactId()
{
return artifactId;
}
/**
* Returns the bundle directory. If null, the module
* is bundled in the root of the EAR.
*
* @return the custom bundle directory
*/
public String getBundleDir()
{
if ( bundleDir != null )
{
bundleDir = cleanBundleDir( bundleDir );
}
return bundleDir;
}
/**
* Returns the bundle file name. If null, the artifact's
* file name is returned.
*
* @return the bundle file name
*/
public String getBundleFileName()
{
if ( bundleFileName == null )
{
bundleFileName = artifact.getFile().getName();
}
return bundleFileName;
}
public String toString()
{
StringBuffer sb = new StringBuffer();
sb.append( getType() ).append( ":" ).append( groupId ).append( ":" ).append( artifactId );
if ( artifact != null )
{
sb.append( ":" ).append( artifact.getVersion() );
}
return sb.toString();
}
/**
* Cleans the bundle directory so that it might be used
* properly.
*
* @param bundleDir the bundle directory to clean
* @return the cleaned bundle directory
*/
private static String cleanBundleDir( String bundleDir )
{
if ( bundleDir == null )
{
return bundleDir;
}
// Using slashes
bundleDir = bundleDir.replace( '\\', '/' );
// Remove '/' prefix if any so that directory is a relative path
if ( bundleDir.startsWith( " / " ) )
{
bundleDir = bundleDir.substring( 1, bundleDir.length() );
}
// Adding '/' suffix to specify a directory structure
if ( !bundleDir.endsWith( "/" ) )
{
bundleDir = bundleDir + "/";
}
System.out.println( "Bundle dir[" + bundleDir + "]" );
return bundleDir;
}
}

View File

@ -18,12 +18,12 @@ package org.apache.maven.plugin.ear;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.ear.module.EarModule;
import org.apache.maven.plugin.ear.module.EarModuleFactory;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -46,48 +46,91 @@ public abstract class AbstractEarMojo
* @parameter expression="${project}"
* @required
* @readonly
* @description "the maven project to use"
*/
private MavenProject project;
/**
* The ear modules configuration.
*
* @parameter
*/
private EarModule[] modules;
/**
* Directory that resources are copied to during the build.
*
* @parameter expression="${project.build.directory}/${project.build.finalName}"
* @required
*/
private String earDirectory;
private String workDirectory;
private List modules;
private List earModules;
private File buildDir;
protected List getModules()
public void execute()
throws MojoExecutionException
{
if ( modules == null )
getLog().debug( "Resolving ear modules ..." );
if ( modules != null && modules.length > 0 )
{
// Gather modules and copy them
modules = new ArrayList();
Set artifacts = project.getArtifacts();
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
// Let's validate user-defined modules
EarModule module = null;
try
{
Artifact artifact = (Artifact) iter.next();
if ( !Artifact.SCOPE_TEST.equals( artifact.getScope()) ||
!Artifact.SCOPE_PROVIDED.equals( artifact.getScope()) )
for ( int i = 0; i < modules.length; i++ )
{
EarModule module = EarModuleFactory.newEarModule( artifact );
modules.add( module );
module = (EarModule) modules[i];
getLog().debug( "Resolving ear module[" + module + "]" );
module.resolveArtifact( project.getArtifacts() );
}
}
catch ( EarPluginException e )
{
throw new MojoExecutionException( "Failed to initialize ear modules", e );
}
earModules = new ArrayList( Arrays.asList( modules ) );
}
return modules;
else
{
earModules = new ArrayList();
}
// Let's add other modules
Set artifacts = project.getArtifacts();
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
{
Artifact artifact = (Artifact) iter.next();
// Artifact is not yet registered and it has neither test, nor a
// provided scope
if ( !isArtifactRegistered( artifact, earModules ) && (
!Artifact.SCOPE_TEST.equals( artifact.getScope() ) ||
!Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) ) )
{
EarModule module = EarModuleFactory.newEarModule( artifact );
earModules.add( module );
}
}
}
protected List getModules()
{
if ( earModules == null )
{
throw new IllegalStateException( "Ear modules have not been initialized" );
}
return earModules;
}
protected File getBuildDir()
{
if ( buildDir == null )
{
buildDir = new File( earDirectory );
buildDir = new File( workDirectory );
}
return buildDir;
}
@ -97,8 +140,22 @@ public abstract class AbstractEarMojo
return project;
}
protected String getEarDirectory()
protected String getWorkDirectory()
{
return earDirectory;
return workDirectory;
}
private static boolean isArtifactRegistered( Artifact a, List currentList )
{
Iterator i = currentList.iterator();
while ( i.hasNext() )
{
EarModule em = (EarModule) i.next();
if ( em.getArtifact().equals( a ) )
{
return true;
}
}
return false;
}
}

View File

@ -1,6 +1,5 @@
package org.apache.maven.plugin.ear;
import org.apache.maven.plugin.ear.module.EarModule;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter;

View File

@ -0,0 +1,68 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.util.xml.XMLWriter;
import java.util.Set;
/**
* The ear module interface.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public interface EarModule
{
/**
* Returns the {@link Artifact} representing this module.
* <p/>
* Note that this might return <tt>null</tt> till the
* module has been resolved.
*
* @return the artifact
* @see #resolveArtifact(java.util.Set)
*/
public Artifact getArtifact();
/**
* Returns the <tt>URI</tt> for this module.
*
* @return the <tt>URI</tt>
*/
public String getUri();
/**
* Appends the <tt>XML</tt> representation of this module.
*
* @param writer the writer to use
* @param version the version of the <tt>application.xml</tt> file
*/
public void appendModule( XMLWriter writer, String version );
/**
* Resolves the {@link Artifact} represented by the module.
*
* @param artifacts the project's artifacts
* @throws EarPluginException if the artifact could not be resolved
*/
public void resolveArtifact( Set artifacts )
throws EarPluginException;
}

View File

@ -0,0 +1,65 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
/**
* Builds an {@link EarModule} based on an <tt>Artifact</tt>.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public final class EarModuleFactory
{
/**
* Creates a new {@link EarModule} based on the
* specified {@link Artifact}.
*
* @param artifact the artifact
* @return an ear module for this artifact
*/
public static final EarModule newEarModule( Artifact artifact )
{
if ( "jar".equals( artifact.getType() ) )
{
return new JavaModule( artifact );
}
else if ( "ejb".equals( artifact.getType() ) )
{
return new EjbModule( artifact );
}
else if ( "ejb-client".equals( artifact.getType() ) )
{
return new EjbClientModule( artifact );
}
else if ( "rar".equals( artifact.getType() ) )
{
return new RarModule( artifact );
}
else if ( "war".equals( artifact.getType() ) )
{
return new WebModule( artifact );
}
else
{
throw new IllegalStateException( "Could not handle artifact type[" + artifact.getType() + "]" );
}
}
}

View File

@ -19,7 +19,6 @@ package org.apache.maven.plugin.ear;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.ear.module.EarModule;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
@ -32,7 +31,7 @@ import java.util.List;
* Builds J2EE Enteprise Archive (EAR) files.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id $
* @version $Id$
* @goal ear
* @phase package
* @requiresDependencyResolution test
@ -77,7 +76,7 @@ public class EarMojo
*
* @parameter alias="earName" expression="${project.build.finalName}"
* @required
* @readonly
* @readonly
*/
private String finalName;
@ -100,11 +99,14 @@ public class EarMojo
public void execute()
throws MojoExecutionException
{
// Initializes ear modules
super.execute();
getLog().debug( " ======= EarMojo settings =======" );
getLog().debug( "earSourceDirectory[" + earSourceDirectory + "]" );
getLog().debug( "manifestLocation[" + manifestLocation + "]" );
getLog().debug( "applicationXmlLocation[" + applicationXmlLocation + "]" );
getLog().debug( "earDirectory[" + getEarDirectory() + "]" );
getLog().debug( "workDirectory[" + getWorkDirectory() + "]" );
getLog().debug( "outputDirectory[" + outputDirectory + "]" );
getLog().debug( "finalName[" + finalName + "]" );
getLog().debug( "excludedDependencies[" + excludedDependencies + "]" );
@ -115,9 +117,9 @@ public class EarMojo
for ( Iterator iter = getModules().iterator(); iter.hasNext(); )
{
EarModule module = (EarModule) iter.next();
getLog().info( "Copying artifact[" + module.getArtifact().getGroupId() + ", " +
module.getArtifact().getId() + ", " + module.getArtifact().getType() + "]" );
FileUtils.copyFileToDirectory( module.getArtifact().getFile(), getBuildDir() );
getLog().info( "Copying artifact[" + module + "] to[" + module.getUri() + "]" );
File destinationFile = buildDestinationFile( getBuildDir(), module.getUri() );
FileUtils.copyFile( module.getArtifact().getFile(), destinationFile );
}
}
catch ( IOException e )
@ -144,7 +146,8 @@ public class EarMojo
File ddFile = new File( getBuildDir(), APPLICATION_XML_URI );
if ( !ddFile.exists() )
{
throw new MojoExecutionException( "Deployment descriptor: " + ddFile.getAbsolutePath() + " does not exist." );
throw new MojoExecutionException(
"Deployment descriptor: " + ddFile.getAbsolutePath() + " does not exist." );
}
try
@ -161,4 +164,9 @@ public class EarMojo
throw new MojoExecutionException( "Error assembling EAR", e );
}
}
private static File buildDestinationFile( File buildDir, String uri )
{
return new File( buildDir, uri );
}
}

View File

@ -19,9 +19,8 @@ package org.apache.maven.plugin.ear;
/**
* The base exception of the EAR plugin.
*
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
* @author $Author: sni $ (last edit)
* @version $Revision: 1.2 $
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public class EarPluginException
extends Exception

View File

@ -0,0 +1,44 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
/**
* The {@link EarModule} implementation for an Ejb-client module.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public class EjbClientModule
extends JavaModule
{
public EjbClientModule()
{
}
public EjbClientModule( Artifact a )
{
super( a );
}
protected String getType()
{
return "ejb-client";
}
}

View File

@ -0,0 +1,55 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.util.xml.XMLWriter;
/**
* The {@link EarModule} implementation for an EJB module.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public class EjbModule
extends AbstractEarModule
{
protected static final String EJB_MODULE = "ejb";
public EjbModule()
{
}
public EjbModule( Artifact a )
{
super( a );
}
public void appendModule( XMLWriter writer, String version )
{
writer.startElement( MODULE_ELEMENT );
writer.startElement( EJB_MODULE );
writer.writeText( getUri() );
writer.endElement();
writer.endElement();
}
protected String getType()
{
return "ejb";
}
}

View File

@ -91,6 +91,9 @@ public class GenerateApplicationXmlMojo
public void execute()
throws MojoExecutionException
{
// Initializes ear modules
super.execute();
getLog().debug( " ======= GenerateApplicationXmlMojo settings =======" );
getLog().debug( "generateApplicationXml[" + generateApplicationXml + "]" );
getLog().debug( "version[" + version + "]" );

View File

@ -0,0 +1,55 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.util.xml.XMLWriter;
/**
* The {@link EarModule} implementation for a J2EE client module.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public class JavaModule
extends AbstractEarModule
{
protected static final String JAVA_MODULE = "java";
public JavaModule()
{
}
public JavaModule( Artifact a )
{
super( a );
}
public void appendModule( XMLWriter writer, String version )
{
writer.startElement( MODULE_ELEMENT );
writer.startElement( JAVA_MODULE );
writer.writeText( getUri() );
writer.endElement();
writer.endElement();
}
protected String getType()
{
return "jar";
}
}

View File

@ -0,0 +1,55 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.util.xml.XMLWriter;
/**
* The {@link EarModule} implementation for an J2EE connector module.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public class RarModule
extends AbstractEarModule
{
protected static final String RAR_MODULE = "connector";
public RarModule()
{
}
public RarModule( Artifact a )
{
super( a );
}
public void appendModule( XMLWriter writer, String version )
{
writer.startElement( MODULE_ELEMENT );
writer.startElement( RAR_MODULE );
writer.writeText( getUri() );
writer.endElement();
writer.endElement();
}
protected String getType()
{
return "rar";
}
}

View File

@ -0,0 +1,111 @@
package org.apache.maven.plugin.ear;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed 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.
*/
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.util.xml.XMLWriter;
import java.util.Set;
/**
* The {@link EarModule} implementation for a Web application module.
*
* @author <a href="stephane.nicoll@gmail.com">Stephane Nicoll</a>
* @version $Id$
*/
public class WebModule
extends AbstractEarModule
{
protected static final String WEB_MODULE = "web";
protected static final String WEB_URI_FIELD = "web-uri";
protected static final String CONTEXT_ROOT_FIELD = "context-root";
private String contextRoot;
public WebModule()
{
}
public WebModule( Artifact a )
{
super( a );
this.contextRoot = getDefaultContextRoot( a );
}
public void appendModule( XMLWriter writer, String version )
{
writer.startElement( MODULE_ELEMENT );
writer.startElement( WEB_MODULE );
writer.startElement( WEB_URI_FIELD );
writer.writeText( getUri() );
writer.endElement(); // web-uri
writer.startElement( CONTEXT_ROOT_FIELD );
writer.writeText( getContextRoot() );
writer.endElement(); // context-root
writer.endElement(); // web
writer.endElement(); // module
}
public void resolveArtifact( Set artifacts )
throws EarPluginException
{
// Let's resolve the artifact
super.resolveArtifact( artifacts );
// Context root has not been customized - using default
if ( contextRoot == null )
{
contextRoot = getDefaultContextRoot( getArtifact() );
}
}
/**
* Returns the context root to use for the web module.
* <p/>
* Note that this might return <tt>null</tt> till the
* artifact has been resolved.
*
* @return the context root
*/
public String getContextRoot()
{
return contextRoot;
}
protected String getType()
{
return "war";
}
/**
* Generates a default context root for the given artifact, based
* on the <tt>artifactId</tt>.
*
* @param a the artifact
* @return a context root for the artifact
*/
private static String getDefaultContextRoot( Artifact a )
{
if ( a == null )
{
throw new NullPointerException( "Artifact could not be null." );
}
return "/" + a.getArtifactId();
}
}

View File

@ -0,0 +1,126 @@
---
Ear Plugin: configuration examples
---
Stéphane Nicoll
---
31-Jul-2005
---
Introduction
The Ear plugin allows to generate automatically the descriptor deployment, e.g.
application.xml. This generation is already customized by basic configuration
items, see <<TODO: ADD A LINK HERE>>.
Ear modules might be further customized as follows:
* contextRoot: the custom context root for a web application
* bundleDir: the directory in the EAR structure where the artifact will be stored
* bundleFileName: the name of the artifact in the EAR structure
* uri: the complete path in the EAR structure for the artifact
Customizing the context root
The sample below shows how to customize the context root of an artifact to be placed
in the EAR file:
+--------
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
[...]
<modules>
<webModule>
<groupId>artifactGroupId</groupId>
<artifactId>artifactId</artifactId>
<contextRoot>/custom-context-root</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
+---------
Customizing a module location
The sample below shows how to place a library in the APP-INF/lib directory of the EAR file:
+--------
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
[...]
<modules>
<javaModule>
<groupId>artifactGroupId</groupId>
<artifactId>artifactId</artifactId>
<bundleDir>APP-INF/lib</bundleDir>
</javaModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
+---------
Customizing a module file name
The sample below shows how to rename a module being placed in the EAR file:
+--------
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
[...]
<modules>
<javaModule>
<groupId>artifactGroupId</groupId>
<artifactId>artifactId</artifactId>
<bundleFileName>anotherName-1.2.3.jar</bundleFileName>
</javaModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
+---------
Customizing a module uri
This is actually a combination of customizing the module's location and file
name. The sample below shows how to specify the URI of a module being placed
in the EAR file:
+--------
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
[...]
<modules>
<javaModule>
<groupId>artifactGroupId</groupId>
<artifactId>artifactId</artifactId>
<uri>APP-INF/lib/anotherName-1.2.3.jar</uri>
</javaModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
+---------

View File

@ -111,7 +111,7 @@
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-4</version>
<version>1.0-alpha-6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>plexus</groupId>

View File

@ -152,7 +152,7 @@
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-4</version>
<version>1.0-alpha-6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>plexus</groupId>