}
try
{
File earFile = getEarFile( outputDirectory, finalName, classifier );
final MavenArchiver archiver = new EarMavenArchiver( getModules() );
final JarArchiver jarArchiver = getJarArchiver();
getLog().debug( "Jar archiver implementation [" + jarArchiver.getClass().getName() + "]" );
archiver.setArchiver( jarArchiver );
archiver.setOutputFile( earFile );
// Include custom manifest if necessary
includeCustomManifestFile();
getLog().debug( "Excluding " + Arrays.asList( getPackagingExcludes() ) + " from the generated EAR." );
getLog().debug( "Including " + Arrays.asList( getPackagingIncludes() ) + " in the generated EAR." );
archiver.getArchiver().addDirectory( getWorkDirectory(), getPackagingIncludes(), getPackagingExcludes() );
archiver.createArchive( session, getProject(), archive );
if ( classifier != null )
{
projectHelper.attachArtifact( getProject(), "ear", classifier, earFile );
}