o Resolved MNG-692, although I think a more general solution is required;

o Fixed another boolean-logic error in the ear plugin.
  Stephane: (x != a) || (x != b) is always true, unless a == b.. ;-)


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@227198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2005-08-03 11:29:36 +00:00
parent 9508fdde65
commit 7a69f15c15
3 changed files with 19 additions and 6 deletions

View File

@ -47,7 +47,7 @@ public abstract class AbstractEarMojo
* @required * @required
* @readonly * @readonly
*/ */
private MavenProject project; protected MavenProject project;
/** /**
* The ear modules configuration. * The ear modules configuration.
@ -106,9 +106,9 @@ public abstract class AbstractEarMojo
// Artifact is not yet registered and it has neither test, nor a // Artifact is not yet registered and it has neither test, nor a
// provided scope // provided scope
if ( !isArtifactRegistered( artifact, earModules ) && ( if ( !isArtifactRegistered( artifact, earModules ) &&
!Artifact.SCOPE_TEST.equals( artifact.getScope() ) || !Artifact.SCOPE_TEST.equals( artifact.getScope() ) &&
!Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) ) ) !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() )
{ {
EarModule module = EarModuleFactory.newEarModule( artifact ); EarModule module = EarModuleFactory.newEarModule( artifact );
earModules.add( module ); earModules.add( module );

View File

@ -119,6 +119,15 @@ public class EarMojo
EarModule module = (EarModule) iter.next(); EarModule module = (EarModule) iter.next();
getLog().info( "Copying artifact[" + module + "] to[" + module.getUri() + "]" ); getLog().info( "Copying artifact[" + module + "] to[" + module.getUri() + "]" );
File destinationFile = buildDestinationFile( getBuildDir(), module.getUri() ); File destinationFile = buildDestinationFile( getBuildDir(), module.getUri() );
File sourceFile = module.getArtifact().getFile();
if ( !sourceFile.isFile() )
{
throw new MojoExecutionException( "Cannot copy a directory: " + sourceFile.getAbsolutePath() +
"; Did you package/install " + module.getArtifact().getId() + "?" );
}
FileUtils.copyFile( module.getArtifact().getFile(), destinationFile ); FileUtils.copyFile( module.getArtifact().getFile(), destinationFile );
} }
} }
@ -158,6 +167,8 @@ public class EarMojo
archiver.getArchiver().addDirectory( getBuildDir() ); archiver.getArchiver().addDirectory( getBuildDir() );
archiver.createArchive( getProject(), archive ); archiver.createArchive( getProject(), archive );
project.getArtifact().setFile( earFile );
} }
catch ( Exception e ) catch ( Exception e )
{ {

View File

@ -112,6 +112,8 @@ public class EjbMojo
// create archive // create archive
archiver.createArchive( project, archive ); archiver.createArchive( project, archive );
project.getArtifact().setFile( jarFile );
if ( new Boolean( generateClient ).booleanValue() ) if ( new Boolean( generateClient ).booleanValue() )
{ {
getLog().info( "Building ejb client " + jarName + "-client" ); getLog().info( "Building ejb client " + jarName + "-client" );