Configured build extension listener to only fire on poms within the build.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@718176 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-11-17 06:23:46 +00:00
parent eec6ed1e2c
commit 629c12ae80
3 changed files with 15 additions and 3 deletions

View File

@ -143,7 +143,7 @@ public final class PomClassicDomainModel
public boolean isPomInBuild()
{
return projectDirectory != null;
return projectDirectory != null && new File(projectDirectory, "pom.xml").exists();
}
/**

View File

@ -176,7 +176,8 @@ public final class DefaultProjectBuilder
transformer,
importModels,
properties,
Arrays.asList((ModelEventListener) new BuildExtensionListener())) );
Arrays.asList((ModelEventListener)
new BuildExtensionListener(domainModel.isPomInBuild()))) );
try
{
MavenProject mavenProject = new MavenProject( transformedDomainModel.getModel(), artifactFactory,

View File

@ -16,8 +16,19 @@ import java.util.ArrayList;
public class BuildExtensionListener
implements ModelEventListener
{
private boolean inBuild;
public BuildExtensionListener(boolean inBuild)
{
this.inBuild = inBuild;
}
public void fire( List<ModelContainer> modelContainers )
{
if(!inBuild) {
return;
}
List<BuildExtension> buildExtensions = new ArrayList<BuildExtension>();
for ( ModelContainer mc : modelContainers )
{
@ -30,7 +41,7 @@ public class BuildExtensionListener
for( BuildExtension be : buildExtensions )
{
System.out.println( "Extension ---> " + be.groupId + " : " + be.artifactId + " : " + be.version );
}
}
}
public List<String> getUris()