diff --git a/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java b/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java index e82d1eb72f..0adddf5ec1 100755 --- a/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java +++ b/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java @@ -99,6 +99,8 @@ public final class PomTransformer ProjectUri.Repositories.xUri) )); + private static Map> cache = new HashMap>(); + /** * @see ModelTransformer#transformToDomainModel(java.util.List, java.util.List) */ @@ -110,6 +112,15 @@ public final class PomTransformer throw new IllegalArgumentException( "properties: null" ); } + if( eventListeners == null ) + { + eventListeners = new ArrayList(); + } + else + { + eventListeners = new ArrayList(eventListeners); + } + List props = new ArrayList( properties ); //dependency management @@ -185,7 +196,7 @@ public final class PomTransformer { ModelDataSource executionSource = new DefaultModelDataSource(); executionSource.init( pluginContainer.getProperties(), - Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) ); + Arrays.asList( new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory() ) ); List executionContainers = executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri ); if ( executionContainers.size() < 2 ) @@ -208,6 +219,16 @@ public final class PomTransformer } } props.removeAll( removeProperties ); + for(ModelEventListener listener : eventListeners) + { + ModelDataSource ds = new DefaultModelDataSource(); + ds.init( props, listener.getModelContainerFactories() ); + for(String uri : listener.getUris() ) + { + listener.fire(ds.queryFor(uri)); + } + } + return factory.createDomainModel( props ); } @@ -276,7 +297,7 @@ public final class PomTransformer { List removeProperties = new ArrayList(); ModelDataSource source = new DefaultModelDataSource(); - source.init( tmp, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) ); + source.init( tmp, Arrays.asList( new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory() ) ); List containers = source.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri ); for ( ModelContainer container : containers )