mirror of https://github.com/apache/maven.git
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:
parent
eec6ed1e2c
commit
629c12ae80
|
@ -143,7 +143,7 @@ public final class PomClassicDomainModel
|
||||||
|
|
||||||
public boolean isPomInBuild()
|
public boolean isPomInBuild()
|
||||||
{
|
{
|
||||||
return projectDirectory != null;
|
return projectDirectory != null && new File(projectDirectory, "pom.xml").exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -176,7 +176,8 @@ public final class DefaultProjectBuilder
|
||||||
transformer,
|
transformer,
|
||||||
importModels,
|
importModels,
|
||||||
properties,
|
properties,
|
||||||
Arrays.asList((ModelEventListener) new BuildExtensionListener())) );
|
Arrays.asList((ModelEventListener)
|
||||||
|
new BuildExtensionListener(domainModel.isPomInBuild()))) );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MavenProject mavenProject = new MavenProject( transformedDomainModel.getModel(), artifactFactory,
|
MavenProject mavenProject = new MavenProject( transformedDomainModel.getModel(), artifactFactory,
|
||||||
|
|
|
@ -16,8 +16,19 @@ import java.util.ArrayList;
|
||||||
public class BuildExtensionListener
|
public class BuildExtensionListener
|
||||||
implements ModelEventListener
|
implements ModelEventListener
|
||||||
{
|
{
|
||||||
|
private boolean inBuild;
|
||||||
|
|
||||||
|
public BuildExtensionListener(boolean inBuild)
|
||||||
|
{
|
||||||
|
this.inBuild = inBuild;
|
||||||
|
}
|
||||||
|
|
||||||
public void fire( List<ModelContainer> modelContainers )
|
public void fire( List<ModelContainer> modelContainers )
|
||||||
{
|
{
|
||||||
|
if(!inBuild) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<BuildExtension> buildExtensions = new ArrayList<BuildExtension>();
|
List<BuildExtension> buildExtensions = new ArrayList<BuildExtension>();
|
||||||
for ( ModelContainer mc : modelContainers )
|
for ( ModelContainer mc : modelContainers )
|
||||||
{
|
{
|
||||||
|
@ -30,7 +41,7 @@ public class BuildExtensionListener
|
||||||
for( BuildExtension be : buildExtensions )
|
for( BuildExtension be : buildExtensions )
|
||||||
{
|
{
|
||||||
System.out.println( "Extension ---> " + be.groupId + " : " + be.artifactId + " : " + be.version );
|
System.out.println( "Extension ---> " + be.groupId + " : " + be.artifactId + " : " + be.version );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUris()
|
public List<String> getUris()
|
||||||
|
|
Loading…
Reference in New Issue