diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
index 1e849104d6..e345f8605e 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
@@ -73,11 +73,9 @@ import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.builder.DefaultInterpolator;
+import org.apache.maven.project.builder.Interpolator;
import org.apache.maven.project.builder.InterpolatorProperty;
-import org.apache.maven.project.builder.ModelProperty;
import org.apache.maven.project.builder.PomInterpolatorTag;
-import org.apache.maven.project.builder.ProcessorContext;
-import org.apache.maven.project.builder.ProjectUri;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.realm.MavenRealmManager;
import org.apache.maven.realm.RealmManagementException;
@@ -153,6 +151,9 @@ public class DefaultPluginManager
@Requirement
protected RepositoryMetadataManager repositoryMetadataManager;
+ @Requirement
+ protected Interpolator interpolator;
+
private Map pluginDefinitionsByPrefix = new HashMap();
public DefaultPluginManager()
@@ -511,7 +512,7 @@ public class DefaultPluginManager
PomInterpolatorTag.EXECUTION_PROPERTIES.name() ) );
interpolatorProperties
.addAll( InterpolatorProperty.toInterpolatorProperties( session.getProjectBuilderConfiguration().getUserProperties(), PomInterpolatorTag.USER_PROPERTIES.name() ) );
- String interpolatedDom = new DefaultInterpolator().interpolateXmlString( String.valueOf( dom ), interpolatorProperties );
+ String interpolatedDom = interpolator.interpolateXmlString( String.valueOf( dom ), interpolatorProperties );
dom = Xpp3DomBuilder.build( new StringReader( interpolatedDom ) );
}
catch ( XmlPullParserException e )
diff --git a/maven-project-builder/pom.xml b/maven-project-builder/pom.xml
index 73f4075022..99a1a620a7 100644
--- a/maven-project-builder/pom.xml
+++ b/maven-project-builder/pom.xml
@@ -26,6 +26,10 @@
org.codehaus.plexus
plexus-utils
+
+ org.codehaus.plexus
+ plexus-component-annotations
+
org.apache.maven
maven-model
@@ -45,6 +49,13 @@
test
-
+
+
+
+ org.codehaus.plexus
+ plexus-component-metadata
+
+
+
diff --git a/maven-project-builder/src/main/java/org/apache/maven/project/builder/DefaultInterpolator.java b/maven-project-builder/src/main/java/org/apache/maven/project/builder/DefaultInterpolator.java
index 4761ead474..08ee915a8e 100644
--- a/maven-project-builder/src/main/java/org/apache/maven/project/builder/DefaultInterpolator.java
+++ b/maven-project-builder/src/main/java/org/apache/maven/project/builder/DefaultInterpolator.java
@@ -25,7 +25,9 @@ import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Reporting;
import org.apache.maven.model.Resource;
+import org.codehaus.plexus.component.annotations.Component;
+@Component(role=Interpolator.class)
public class DefaultInterpolator implements Interpolator {
public String interpolateXmlString(String xml,
diff --git a/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProcessorContext.java b/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProcessorContext.java
index 21152eda5f..0561a75951 100644
--- a/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProcessorContext.java
+++ b/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProcessorContext.java
@@ -40,6 +40,53 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
public class ProcessorContext
{
+ /**
+ * Parent domain models on bottom.
+ *
+ * @param domainModels
+ * @param listeners
+ * @return
+ * @throws IOException
+ */
+ public static PomClassicDomainModel build( List domainModels, List listeners )
+ throws IOException
+ {
+ PomClassicDomainModel child = null;
+ for ( DomainModel domainModel : domainModels )
+ {
+ if(domainModel.isMostSpecialized())
+ {
+ child = (PomClassicDomainModel) domainModel;
+ }
+ }
+ if(child == null)
+ {
+ throw new IOException("Could not find child model");
+ }
+
+ List processors =
+ Arrays. asList( new BuildProcessor( new ArrayList() ), new ModuleProcessor(),
+ new PropertiesProcessor(), new ParentProcessor(), new OrganizationProcessor(),
+ new MailingListProcessor(), new IssueManagementProcessor(),
+ new CiManagementProcessor(), new ReportingProcessor(),
+ new RepositoriesProcessor(), new DistributionManagementProcessor(),
+ new LicensesProcessor(), new ScmProcessor(), new PrerequisitesProcessor(),
+ new ContributorsProcessor(), new DevelopersProcessor(), new ProfilesProcessor() );
+ Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels ), processors );
+ if(listeners != null)
+ {
+ for(ModelEventListener listener : listeners)
+ {
+ listener.fire(target);
+ }
+ }
+ PomClassicDomainModel domainModel = new PomClassicDomainModel( target, child.isMostSpecialized() );
+ domainModel.setProjectDirectory(child.getProjectDirectory());
+ domainModel.setParentFile(child.getParentFile());
+
+ return domainModel;
+ }
+
public static PomClassicDomainModel mergeProfilesIntoModel(Collection profiles, PomClassicDomainModel domainModel) throws IOException
{
List profileModels = new ArrayList();
@@ -150,53 +197,6 @@ public class ProcessorContext
return models;
}
-
- /**
- * Parent domain models on bottom.
- *
- * @param domainModels
- * @param listeners
- * @return
- * @throws IOException
- */
- public static PomClassicDomainModel build( List domainModels, List listeners )
- throws IOException
- {
- PomClassicDomainModel child = null;
- for ( DomainModel domainModel : domainModels )
- {
- if(domainModel.isMostSpecialized())
- {
- child = (PomClassicDomainModel) domainModel;
- }
- }
- if(child == null)
- {
- throw new IOException("Could not find child model");
- }
-
- List processors =
- Arrays. asList( new BuildProcessor( new ArrayList() ), new ModuleProcessor(),
- new PropertiesProcessor(), new ParentProcessor(), new OrganizationProcessor(),
- new MailingListProcessor(), new IssueManagementProcessor(),
- new CiManagementProcessor(), new ReportingProcessor(),
- new RepositoriesProcessor(), new DistributionManagementProcessor(),
- new LicensesProcessor(), new ScmProcessor(), new PrerequisitesProcessor(),
- new ContributorsProcessor(), new DevelopersProcessor(), new ProfilesProcessor() );
- Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels ), processors );
- if(listeners != null)
- {
- for(ModelEventListener listener : listeners)
- {
- listener.fire(target);
- }
- }
- PomClassicDomainModel domainModel = new PomClassicDomainModel( target, child.isMostSpecialized() );
- domainModel.setProjectDirectory(child.getProjectDirectory());
- domainModel.setParentFile(child.getParentFile());
-
- return domainModel;
- }
private static Model processModelsForInheritance(List models, List processors)
{
diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
index 05f32895df..441650582f 100644
--- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
+++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
@@ -45,6 +45,7 @@ import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.builder.DefaultInterpolator;
import org.apache.maven.project.builder.DomainModel;
+import org.apache.maven.project.builder.Interpolator;
import org.apache.maven.project.builder.InterpolatorProperty;
import org.apache.maven.project.builder.ModelEventListener;
import org.apache.maven.project.builder.PomClassicDomainModel;
@@ -84,6 +85,9 @@ public class DefaultMavenProjectBuilder
@Requirement
List listeners;
+ @Requirement
+ private Interpolator interpolator;
+
@Requirement
private ResolutionErrorHandler resolutionErrorHandler;
@@ -387,20 +391,7 @@ public class DefaultMavenProjectBuilder
try
{
- //List mps = domainModel.getModelProperties();
- model = new DefaultInterpolator().interpolateDomainModel( domainModel, interpolatorProperties ).getModel();
- /*
- if ( domainModel.getProjectDirectory() != null )
- {
- mps = ProcessorContext.alignPaths( mps, domainModel.getProjectDirectory() );
- }
- File f = domainModel.getParentFile();
- domainModel = new PomClassicDomainModel( mps, false );
- domainModel.setParentFile(f);
-
- model = domainModel.getModel();
- */
-
+ model = interpolator.interpolateDomainModel( domainModel, interpolatorProperties ).getModel();
}
catch ( IOException e )
{