Author: sisbell Date: Fri Apr 17 17:16:55 2009 New Revision: 766088 URL: http://svn.apache.org/viewvc?rev=766088&view=rev Log: Moved interpolator classes into their own package.
Added: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ (with props) maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/DefaultInterpolator.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/Interpolator.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/InterpolatorProperty.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ModelProperty.java - copied, changed from r766081, maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/ModelProperty.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/PomInterpolatorTag.java Removed: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/DefaultInterpolator.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/Interpolator.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/InterpolatorProperty.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/ModelProperty.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/PomInterpolatorTag.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/interpolator/ Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/ProfileManagerInfo.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/DefaultMatcher.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/FileMatcher.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/JdkMatcher.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/ProfileMatcher.java maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/PropertyMatcher.java maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/matchers/JdkMatcherTest.java maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original) +++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Fri Apr 17 17:16:55 2009 @@ -60,6 +60,10 @@ import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.apache.maven.model.ReportPlugin; +import org.apache.maven.model.interpolator.DefaultInterpolator; +import org.apache.maven.model.interpolator.Interpolator; +import org.apache.maven.model.interpolator.InterpolatorProperty; +import org.apache.maven.model.interpolator.PomInterpolatorTag; import org.apache.maven.monitor.event.EventDispatcher; import org.apache.maven.monitor.event.MavenEvents; import org.apache.maven.monitor.logging.DefaultLog; @@ -72,10 +76,6 @@ 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.PomInterpolatorTag; import org.apache.maven.project.path.PathTranslator; import org.apache.maven.realm.MavenRealmManager; import org.apache.maven.realm.RealmManagementException; Modified: maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java (original) +++ maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java Fri Apr 17 17:16:55 2009 @@ -29,10 +29,10 @@ import org.apache.maven.mercury.builder.api.DependencyProcessorException; import org.apache.maven.mercury.builder.api.MetadataReader; import org.apache.maven.mercury.builder.api.MetadataReaderException; -import org.apache.maven.project.builder.DefaultInterpolator; +import org.apache.maven.model.interpolator.DefaultInterpolator; +import org.apache.maven.model.interpolator.InterpolatorProperty; +import org.apache.maven.model.interpolator.PomInterpolatorTag; import org.apache.maven.project.builder.DomainModel; -import org.apache.maven.project.builder.InterpolatorProperty; -import org.apache.maven.project.builder.PomInterpolatorTag; import org.apache.maven.project.builder.ProcessorContext; import org.codehaus.plexus.component.annotations.Component; Propchange: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ ------------------------------------------------------------------------------ svn:mergeinfo = Added: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/DefaultInterpolator.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/DefaultInterpolator.java?rev=766088&view=auto ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/DefaultInterpolator.java (added) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/DefaultInterpolator.java Fri Apr 17 17:16:55 2009 @@ -0,0 +1,811 @@ +package org.apache.maven.model.interpolator; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +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.apache.maven.project.builder.PomClassicDomainModel; +import org.apache.maven.project.builder.ProjectUri; +import org.codehaus.plexus.component.annotations.Component; + +...@component(role=Interpolator.class) +public class DefaultInterpolator implements Interpolator { + + public String interpolateXmlString(String xml, + List<InterpolatorProperty> interpolatorProperties) throws IOException + { + List<ModelProperty> modelProperties = marshallXmlToModelProperties( new ByteArrayInputStream( xml.getBytes() ), ProjectUri.baseUri, URIS ); + + Map<String, String> aliases = new HashMap<String, String>(); + aliases.put( "project.", "pom." ); + + List<InterpolatorProperty> ips = new ArrayList<InterpolatorProperty>( interpolatorProperties ); + ips.addAll( createInterpolatorProperties( modelProperties, ProjectUri.baseUri, aliases, PomInterpolatorTag.PROJECT_PROPERTIES.name()) ); + + for ( ModelProperty mp : modelProperties ) + { + if ( mp.getUri().startsWith( ProjectUri.properties ) && mp.getValue() != null ) + { + String uri = mp.getUri(); + ips.add( new InterpolatorProperty( "${" + uri.substring( uri.lastIndexOf( "/" ) + 1, uri.length() ) + "}", mp.getValue() ) ); + } + } + + interpolateModelProperties( modelProperties, ips ); + return unmarshalModelPropertiesToXml( modelProperties, ProjectUri.baseUri ); + } + + public PomClassicDomainModel interpolateDomainModel( PomClassicDomainModel dm, List<InterpolatorProperty> interpolatorProperties ) + throws IOException { + + if (dm == null) { + throw new IllegalArgumentException("dm: null"); + } + if (!containsProjectVersion(interpolatorProperties)) { + aliases.put("\\$\\{project.version\\}", "\\$\\{version\\}"); + } + //TODO: Insert customized logic for parsing + List<ModelProperty> modelProperties = getModelProperties(dm.getInputStream()); + + if ("jar".equals(dm.getModel().getPackaging())) { + modelProperties.add(new ModelProperty(ProjectUri.packaging, "jar")); + } + + List<ModelProperty> firstPassModelProperties = new ArrayList<ModelProperty>(); + List<ModelProperty> secondPassModelProperties = new ArrayList<ModelProperty>(); + + ModelProperty buildProperty = new ModelProperty(ProjectUri.Build.xUri, + null); + + for ( ModelProperty mp : modelProperties ) + { + if ( mp.getValue() != null && !mp.getUri().contains( "#property" ) && !mp.getUri().contains( "#collection" ) ) + { + if ( ( !buildProperty.isParentOf( mp ) && !mp.getUri().equals( ProjectUri.Reporting.outputDirectory ) || mp.getUri().equals( + ProjectUri.Build.finalName ) ) ) + { + firstPassModelProperties.add( mp ); + } + else + { + secondPassModelProperties.add( mp ); + } + } + } + + List<InterpolatorProperty> standardInterpolatorProperties = new ArrayList<InterpolatorProperty>(); + + if (dm.isPomInBuild()) { + String basedir = dm.getProjectDirectory().getAbsolutePath(); + standardInterpolatorProperties.add(new InterpolatorProperty( + "${project.basedir}", basedir, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + standardInterpolatorProperties.add(new InterpolatorProperty( + "${basedir}", basedir, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + standardInterpolatorProperties.add(new InterpolatorProperty( + "${pom.basedir}", basedir, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + + String baseuri = dm.getProjectDirectory().toURI().toString(); + standardInterpolatorProperties.add(new InterpolatorProperty( + "${project.baseUri}", baseuri, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + standardInterpolatorProperties.add(new InterpolatorProperty( + "${pom.baseUri}", baseuri, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + } + + for (ModelProperty mp : modelProperties) { + if (mp.getUri().startsWith(ProjectUri.properties) + && mp.getValue() != null) { + String uri = mp.getUri(); + standardInterpolatorProperties.add(new InterpolatorProperty( + "${" + + uri.substring(uri.lastIndexOf("/") + 1, uri + .length()) + "}", mp.getValue(), + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + } + } + + // FIRST PASS - Withhold using build directories as interpolator + // properties + List<InterpolatorProperty> ips1 = new ArrayList<InterpolatorProperty>( + interpolatorProperties); + ips1.addAll(standardInterpolatorProperties); + ips1.addAll(createInterpolatorProperties( + firstPassModelProperties, ProjectUri.baseUri, aliases, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + Collections.sort(ips1, new Comparator<InterpolatorProperty>() { + public int compare(InterpolatorProperty o, InterpolatorProperty o1) { + if (o.getTag() == null || o1.getTag() == null) { + return 0; + } + return PomInterpolatorTag.valueOf(o.getTag()).compareTo( + PomInterpolatorTag.valueOf(o1.getTag())); + } + }); + + interpolateModelProperties(modelProperties, ips1); + + // SECOND PASS - Set absolute paths on build directories + if (dm.isPomInBuild()) { + String basedir = dm.getProjectDirectory().getAbsolutePath(); + Map<ModelProperty, ModelProperty> buildDirectories = new HashMap<ModelProperty, ModelProperty>(); + for (ModelProperty mp : secondPassModelProperties) { + if (mp.getUri().startsWith(ProjectUri.Build.xUri) + || mp.getUri().equals( + ProjectUri.Reporting.outputDirectory)) { + File file = new File(mp.getResolvedValue()); + if (!file.isAbsolute() + && !mp.getResolvedValue().startsWith( + "${project.build.") + && !mp.getResolvedValue().equals( + "${project.basedir}")) { + buildDirectories.put(mp, new ModelProperty(mp.getUri(), + new File(basedir, file.getPath()) + .getAbsolutePath())); + } + } + } + for (Map.Entry<ModelProperty, ModelProperty> e : buildDirectories + .entrySet()) { + secondPassModelProperties.remove(e.getKey()); + secondPassModelProperties.add(e.getValue()); + } + } + + // THIRD PASS - Use build directories as interpolator properties + List<InterpolatorProperty> ips2 = new ArrayList<InterpolatorProperty>( + interpolatorProperties); + ips2.addAll(standardInterpolatorProperties); + ips2.addAll(createInterpolatorProperties( + secondPassModelProperties, ProjectUri.baseUri, aliases, + PomInterpolatorTag.PROJECT_PROPERTIES.name())); + ips2.addAll(interpolatorProperties); + Collections.sort(ips2, new Comparator<InterpolatorProperty>() { + public int compare(InterpolatorProperty o, InterpolatorProperty o1) { + if (o.getTag() == null || o1.getTag() == null) { + return 0; + } + + return PomInterpolatorTag.valueOf(o.getTag()).compareTo( + PomInterpolatorTag.valueOf(o1.getTag())); + } + }); + + interpolateModelProperties(modelProperties, ips2); + + try + { + String xml = unmarshalModelPropertiesToXml( modelProperties, ProjectUri.baseUri ); + PomClassicDomainModel domainModel = new PomClassicDomainModel( new ByteArrayInputStream ( xml.getBytes( "UTF-8" ))); + if ( dm.getProjectDirectory() != null ) + { + alignPaths(domainModel.getModel(), dm.getProjectDirectory()); + } + return domainModel; + } + catch ( IOException e ) + { + throw new IllegalStateException( "Unmarshalling of model properties failed", e ); + } + + + + /* + for(ModelProperty mp : modelProperties) + { + if((mp.getValue() != null) && !mp.getValue().equals(mp.getResolvedValue())) + { + if(mp.getUri().equals(ProjectUri.version)) + { + + } + } + } + */ + } + /** + * Post-processes the paths of build directories by aligning relative paths to the project directory and normalizing + * file separators to the platform-specific separator. + * + * @param model The model to process, must not be {...@code null}. + * @param basedir The project directory, must not be {...@code null}. + */ + private static void alignPaths( Model model, File basedir ) + { + Build build = model.getBuild(); + if ( build != null ) + { + build.setDirectory( getAlignedPathFor( build.getDirectory(), basedir ) ); + build.setOutputDirectory( getAlignedPathFor( build.getOutputDirectory(), basedir ) ); + build.setTestOutputDirectory( getAlignedPathFor( build.getTestOutputDirectory(), basedir ) ); + build.setSourceDirectory( getAlignedPathFor( build.getSourceDirectory(), basedir ) ); + build.setTestSourceDirectory( getAlignedPathFor( build.getTestSourceDirectory(), basedir ) ); + build.setScriptSourceDirectory( getAlignedPathFor( build.getScriptSourceDirectory(), basedir ) ); + + for ( Resource r : build.getResources() ) + { + r.setDirectory( getAlignedPathFor( r.getDirectory(), basedir ) ); + } + + for ( Resource r : build.getTestResources() ) + { + r.setDirectory( getAlignedPathFor( r.getDirectory(), basedir ) ); + } + + List<String> filters = new ArrayList<String>(); + for ( String f : build.getFilters() ) + { + filters.add( getAlignedPathFor( f, basedir ) ); + } + build.setFilters( filters ); + } + + Reporting reporting = model.getReporting(); + if ( reporting != null ) + { + reporting.setOutputDirectory( getAlignedPathFor( reporting.getOutputDirectory(), basedir ) ); + } + + } + + private static String getAlignedPathFor(String path, File basedir) + { + if ( path != null ) + { + File file = new File( path ); + if ( file.isAbsolute() ) + { + // path was already absolute, just normalize file separator and we're done + path = file.getPath(); + } + else if ( file.getPath().startsWith( File.separator ) ) + { + // drive-relative Windows path, don't align with project directory but with drive root + path = file.getAbsolutePath(); + } + else + { + // an ordinary relative path, align with project directory + path = new File( new File( basedir, path ).toURI().normalize() ).getAbsolutePath(); + } + } + return path; + } + private static void interpolateModelProperties(List<ModelProperty> modelProperties, + List<InterpolatorProperty> interpolatorProperties ) + { + if (modelProperties == null) { + throw new IllegalArgumentException("modelProperties: null"); + } + + if (interpolatorProperties == null) { + throw new IllegalArgumentException("interpolatorProperties: null"); + } + + List<ModelProperty> unresolvedProperties = new ArrayList<ModelProperty>(); + for (ModelProperty mp : modelProperties) { + if (!mp.isResolved()) { + unresolvedProperties.add(mp); + } + } + + LinkedHashSet<InterpolatorProperty> ips = new LinkedHashSet<InterpolatorProperty>(); + ips.addAll(interpolatorProperties); + boolean continueInterpolation = true; + while (continueInterpolation) { + continueInterpolation = false; + for (InterpolatorProperty ip : ips) { + for (ModelProperty mp : unresolvedProperties) { + if (mp.resolveWith(ip) && !continueInterpolation) { + continueInterpolation = true; + break; + } + } + } + } + } + + private static List<InterpolatorProperty> createInterpolatorProperties(List<ModelProperty> modelProperties, + String baseUriForModel, + Map<String, String> aliases, + String interpolatorTag) + { + if (modelProperties == null) { + throw new IllegalArgumentException("modelProperties: null"); + } + + if (baseUriForModel == null) { + throw new IllegalArgumentException("baseUriForModel: null"); + } + + List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>(); + + for (ModelProperty mp : modelProperties) { + InterpolatorProperty ip = mp + .asInterpolatorProperty(baseUriForModel); + if (ip != null) { + ip.setTag(interpolatorTag); + interpolatorProperties.add(ip); + for (Map.Entry<String, String> a : aliases.entrySet()) { + interpolatorProperties.add(new InterpolatorProperty(ip + .getKey().replaceAll(a.getKey(), a.getValue()), ip + .getValue().replaceAll(a.getKey(), a.getValue()), + interpolatorTag)); + } + } + } + + List<InterpolatorProperty> ips = new ArrayList<InterpolatorProperty>(); + for (InterpolatorProperty ip : interpolatorProperties) { + if (!ips.contains(ip)) { + ips.add(ip); + } + } + return ips; + } + + private static List<ModelProperty> getModelProperties(InputStream is) throws IOException + { + Set<String> s = new HashSet<String>(); + //TODO: Should add all collections from ProjectUri + s.addAll(URIS); + s.add(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.xUri); + s.add(ProjectUri.DependencyManagement.Dependencies.Dependency.Exclusions.xUri); + s.add(ProjectUri.Dependencies.Dependency.Exclusions.xUri); + s.add(ProjectUri.Build.Plugins.Plugin.Executions.xUri); + s.add(ProjectUri.Build.Plugins.Plugin.Executions.Execution.Goals.xURI); + s.add(ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri); + s.add(ProjectUri.Reporting.Plugins.Plugin.ReportSets.ReportSet.configuration); + s.add(ProjectUri.Build.Plugins.Plugin.Executions.Execution.configuration); + //TODO: More profile info + s.add(ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.Plugin.Executions.xUri); + s.add(ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.Dependency.Exclusions.xUri); + s.add(ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri); + s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.xUri); + s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.Execution.Goals.xURI); + s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.xUri); + s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.ReportSet.configuration); + s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.Execution.configuration); + s.add(ProjectUri.Profiles.Profile.properties); + s.add(ProjectUri.Profiles.Profile.modules); + s.add(ProjectUri.Profiles.Profile.Dependencies.xUri); + s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.configuration); + + return new ArrayList<ModelProperty>(marshallXmlToModelProperties(is, ProjectUri.baseUri, s )); + } + + /** + * Returns XML string unmarshalled from the specified list of model properties + * + * @param modelProperties the model properties to unmarshal. May not be null or empty + * @param baseUri the base uri of every model property. May not be null or empty. + * @return XML string unmarshalled from the specified list of model properties + * @throws IOException if there was a problem with unmarshalling + */ + private static String unmarshalModelPropertiesToXml( List<ModelProperty> modelProperties, String baseUri ) + throws IOException + { + if ( modelProperties == null || modelProperties.isEmpty() ) + { + throw new IllegalArgumentException( "modelProperties: null or empty" ); + } + + if ( baseUri == null || baseUri.trim().length() == 0 ) + { + throw new IllegalArgumentException( "baseUri: null or empty" ); + } + + final int basePosition = baseUri.length(); + + StringBuffer sb = new StringBuffer(); + List<String> lastUriTags = new ArrayList<String>(); + for ( ModelProperty mp : modelProperties ) + { + String uri = mp.getUri(); + if ( uri.contains( "#property" ) ) + { + continue; + } + + //String val = (mp.getResolvedValue() != null) ? "\"" + mp.getResolvedValue() + "\"" : null; + // System.out.println("new ModelProperty(\"" + mp.getUri() +"\" , " + val +"),"); + if ( !uri.startsWith( baseUri ) ) + { + throw new IllegalArgumentException( + "Passed in model property that does not match baseUri: Property URI = " + uri + ", Base URI = " + + baseUri ); + } + + List<String> tagNames = getTagNamesFromUri( basePosition, uri ); + + for ( int i = lastUriTags.size() - 1; i >= 0 && i >= tagNames.size() - 1; i-- ) + { + sb.append( toEndTag( lastUriTags.get( i ) ) ); + } + + String tag = tagNames.get( tagNames.size() - 1 ); + + List<ModelProperty> attributes = new ArrayList<ModelProperty>(); + for(int peekIndex = modelProperties.indexOf( mp ) + 1; peekIndex < modelProperties.size(); peekIndex++) + { + if ( peekIndex <= modelProperties.size() - 1 ) + { + ModelProperty peekProperty = modelProperties.get( peekIndex ); + if ( peekProperty.getUri().contains( "#property" ) ) + { + attributes.add(peekProperty); + } + else + { + break; + } + } + else + { + break; + } + } + + sb.append( toStartTag( tag, attributes ) ); + + if ( mp.getResolvedValue() != null ) + { + sb.append( mp.getResolvedValue() ); + } + + lastUriTags = tagNames; + } + + for ( int i = lastUriTags.size() - 1; i >= 1; i-- ) + { + sb.append( toEndTag( lastUriTags.get( i ) ) ); + } + + return sb.toString(); + } + + /** + * Returns list of tag names parsed from the specified uri. All #collection parts of the tag are removed from the + * tag names. + * + * @param basePosition the base position in the specified URI to start the parse + * @param uri the uri to parse for tag names + * @return list of tag names parsed from the specified uri + */ + private static List<String> getTagNamesFromUri( int basePosition, String uri ) + { + return Arrays.asList( uri.substring( basePosition ).replaceAll( "#collection", "" ) + .replaceAll("#set", "").split( "/" ) ); + } + + /** + * Returns the XML formatted start tag for the specified value and the specified attribute. + * + * @param value the value to use for the start tag + * @param attributes the attribute to use in constructing of start tag + * @return the XML formatted start tag for the specified value and the specified attribute + */ + private static String toStartTag( String value, List<ModelProperty> attributes ) + { + StringBuffer sb = new StringBuffer(); //TODO: Support more than one attribute + sb.append( "\r\n<" ).append( value ); + if ( attributes != null ) + { + for(ModelProperty attribute : attributes) + { + sb.append( " " ).append( + attribute.getUri().substring( attribute.getUri().indexOf( "#property/" ) + 10 ) ).append( "=\"" ) + .append( attribute.getResolvedValue() ).append( "\" " ); + } + } + sb.append( ">" ); + return sb.toString(); + } + + /** + * Returns XML formatted end tag for the specified value. + * + * @param value the value to use for the end tag + * @return xml formatted end tag for the specified value + */ + private static String toEndTag( String value ) + { + if ( value.trim().length() == 0 ) + { + return ""; + } + StringBuffer sb = new StringBuffer(); + sb.append( "</" ).append( value ).append( ">" ); + return sb.toString(); + } + + + private static final Set<String> URIS = Collections.unmodifiableSet(new HashSet<String>( Arrays.asList( ProjectUri.Build.Extensions.xUri, + ProjectUri.Build.PluginManagement.Plugins.xUri, + ProjectUri.Build.PluginManagement.Plugins.Plugin.configuration, + ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.xUri, + ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.xURI, + ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri, + ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri, + ProjectUri.Build.Plugins.xUri, + ProjectUri.properties, + ProjectUri.Build.Plugins.Plugin.configuration, + ProjectUri.Reporting.Plugins.xUri, + ProjectUri.Reporting.Plugins.Plugin.configuration, + ProjectUri.Build.Plugins.Plugin.Dependencies.xUri, + ProjectUri.Build.Resources.xUri, + ProjectUri.Build.Resources.Resource.includes, + ProjectUri.Build.Resources.Resource.excludes, + ProjectUri.Build.TestResources.xUri, + ProjectUri.Build.Filters.xUri, + ProjectUri.CiManagement.Notifiers.xUri, + ProjectUri.Contributors.xUri, + ProjectUri.Dependencies.xUri, + ProjectUri.DependencyManagement.Dependencies.xUri, + ProjectUri.Developers.xUri, + ProjectUri.Developers.Developer.roles, + ProjectUri.Licenses.xUri, + ProjectUri.MailingLists.xUri, + ProjectUri.Modules.xUri, + ProjectUri.PluginRepositories.xUri, + ProjectUri.Profiles.xUri, + ProjectUri.Profiles.Profile.Build.Plugins.xUri, + ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Dependencies.xUri, + ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.xUri, + ProjectUri.Profiles.Profile.Build.Resources.xUri, + ProjectUri.Profiles.Profile.Build.TestResources.xUri, + ProjectUri.Profiles.Profile.Dependencies.xUri, + ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri, + ProjectUri.Profiles.Profile.PluginRepositories.xUri, + ProjectUri.Profiles.Profile.Reporting.Plugins.xUri, + ProjectUri.Profiles.Profile.Repositories.xUri, + ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.xUri, + ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri, + ProjectUri.Reporting.Plugins.xUri, + ProjectUri.Repositories.xUri) )); + + /** + * Returns list of model properties transformed from the specified input stream. + * + * @param inputStream input stream containing the xml document. May not be null. + * @param baseUri the base uri of every model property. May not be null or empty. + * @param collections set of uris that are to be treated as a collection (multiple entries). May be null. + * @return list of model properties transformed from the specified input stream. + * @throws IOException if there was a problem doing the transform + */ + private static List<ModelProperty> marshallXmlToModelProperties( InputStream inputStream, String baseUri, + Set<String> collections ) + throws IOException { + if (inputStream == null) { + throw new IllegalArgumentException("inputStream: null"); + } + + if (baseUri == null || baseUri.trim().length() == 0) { + throw new IllegalArgumentException("baseUri: null"); + } + + if (collections == null) { + collections = Collections.emptySet(); + } + + List<ModelProperty> modelProperties = new ArrayList<ModelProperty>(); + XMLInputFactory xmlInputFactory = new com.ctc.wstx.stax.WstxInputFactory(); + xmlInputFactory.setProperty( + XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); + xmlInputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, + Boolean.FALSE); + + Uri uri = new Uri(baseUri); + String tagName = baseUri; + StringBuilder tagValue = new StringBuilder(256); + + int depth = 0; + int depthOfTagValue = depth; + XMLStreamReader xmlStreamReader = null; + try { + xmlStreamReader = xmlInputFactory + .createXMLStreamReader(inputStream); + + Map<String, String> attributes = new HashMap<String, String>(); + for (;; xmlStreamReader.next()) { + int type = xmlStreamReader.getEventType(); + switch (type) { + + case XMLStreamConstants.CDATA: + case XMLStreamConstants.CHARACTERS: { + if (depth == depthOfTagValue) { + tagValue.append(xmlStreamReader.getTextCharacters(), + xmlStreamReader.getTextStart(), xmlStreamReader + .getTextLength()); + } + break; + } + + case XMLStreamConstants.START_ELEMENT: { + if (!tagName.equals(baseUri)) { + String value = null; + if (depth < depthOfTagValue) { + value = tagValue.toString().trim(); + } + modelProperties.add(new ModelProperty(tagName, value)); + if (!attributes.isEmpty()) { + for (Map.Entry<String, String> e : attributes + .entrySet()) { + modelProperties.add(new ModelProperty(e + .getKey(), e.getValue())); + } + attributes.clear(); + } + } + + depth++; + tagName = uri.getUriFor(xmlStreamReader.getName() + .getLocalPart(), depth); + if (collections.contains(tagName + "#collection")) { + tagName = tagName + "#collection"; + uri.addTag(xmlStreamReader.getName().getLocalPart() + + "#collection"); + } else if (collections.contains(tagName + "#set")) { + tagName = tagName + "#set"; + uri.addTag(xmlStreamReader.getName().getLocalPart() + + "#set"); + } else { + uri.addTag(xmlStreamReader.getName().getLocalPart()); + } + tagValue.setLength(0); + depthOfTagValue = depth; + } + case XMLStreamConstants.ATTRIBUTE: { + for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++) { + + attributes.put(tagName + + "#property/" + + xmlStreamReader.getAttributeName(i) + .getLocalPart(), xmlStreamReader + .getAttributeValue(i)); + } + break; + } + case XMLStreamConstants.END_ELEMENT: { + depth--; + break; + } + case XMLStreamConstants.END_DOCUMENT: { + modelProperties.add(new ModelProperty(tagName, tagValue + .toString().trim())); + if (!attributes.isEmpty()) { + for (Map.Entry<String, String> e : attributes + .entrySet()) { + modelProperties.add(new ModelProperty(e.getKey(), e + .getValue())); + } + attributes.clear(); + } + return modelProperties; + } + } + } + } catch (XMLStreamException e) { + throw new IOException(":" + e.toString()); + } finally { + if (xmlStreamReader != null) { + try { + xmlStreamReader.close(); + } catch (XMLStreamException e) { + e.printStackTrace(); + } + } + try { + inputStream.close(); + } catch (IOException e) { + + } + } + } + + private static final Map<String, String> aliases = new HashMap<String, String>(); + + private static void addProjectAlias( String element, boolean leaf ) + { + String suffix = leaf ? "\\}" : "\\."; + aliases.put( "\\$\\{project\\." + element + suffix, "\\$\\{" + element + suffix ); + } + + static + { + aliases.put( "\\$\\{project\\.", "\\$\\{pom\\." ); + addProjectAlias( "modelVersion", true ); + addProjectAlias( "groupId", true ); + addProjectAlias( "artifactId", true ); + addProjectAlias( "version", true ); + addProjectAlias( "packaging", true ); + addProjectAlias( "name", true ); + addProjectAlias( "description", true ); + addProjectAlias( "inceptionYear", true ); + addProjectAlias( "url", true ); + addProjectAlias( "parent", false ); + addProjectAlias( "prerequisites", false ); + addProjectAlias( "organization", false ); + addProjectAlias( "build", false ); + addProjectAlias( "reporting", false ); + addProjectAlias( "scm", false ); + addProjectAlias( "distributionManagement", false ); + addProjectAlias( "issueManagement", false ); + addProjectAlias( "ciManagement", false ); + } + + private static boolean containsProjectVersion( List<InterpolatorProperty> interpolatorProperties ) + { + InterpolatorProperty versionInterpolatorProperty = + new ModelProperty( ProjectUri.version, "" ).asInterpolatorProperty( ProjectUri.baseUri ); + for ( InterpolatorProperty ip : interpolatorProperties ) + { + if ( ip.equals( versionInterpolatorProperty ) ) + { + return true; + } + } + return false; + } + /** + * Class for storing information about URIs. + */ + private static class Uri + { + + List<String> uris; + + Uri( String baseUri ) + { + uris = new LinkedList<String>(); + uris.add( baseUri ); + } + + String getUriFor( String tag, int depth ) + { + setUrisToDepth( depth ); + StringBuffer sb = new StringBuffer(); + for ( String tagName : uris ) + { + sb.append( tagName ).append( "/" ); + } + sb.append( tag ); + return sb.toString(); + } + + void addTag( String tag ) + { + uris.add( tag ); + } + + void setUrisToDepth( int depth ) + { + uris = new LinkedList<String>( uris.subList( 0, depth ) ); + } + } + +} Added: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/Interpolator.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/Interpolator.java?rev=766088&view=auto ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/Interpolator.java (added) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/Interpolator.java Fri Apr 17 17:16:55 2009 @@ -0,0 +1,17 @@ +package org.apache.maven.model.interpolator; + +import java.io.IOException; +import java.util.List; + +import org.apache.maven.project.builder.PomClassicDomainModel; + +public interface Interpolator +{ + + String interpolateXmlString( String xml, List<InterpolatorProperty> interpolatorProperties ) + throws IOException; + + PomClassicDomainModel interpolateDomainModel( PomClassicDomainModel dm, List<InterpolatorProperty> interpolatorProperties ) + throws IOException ; + +} Added: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/InterpolatorProperty.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/InterpolatorProperty.java?rev=766088&view=auto ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/InterpolatorProperty.java (added) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/InterpolatorProperty.java Fri Apr 17 17:16:55 2009 @@ -0,0 +1,175 @@ +package org.apache.maven.model.interpolator; + +import java.util.*; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Provides interpolator property information. + */ +public final class InterpolatorProperty +{ + /** + * The key (or name) of the property + */ + private final String key; + + /** + * The value of the property + */ + private final String value; + + /** + * Metadata tag (general use) + */ + private String tag; + + + /** + * Constructor + * + * @param key the key (or name) of the property. May not be null + * @param value the value of the property. May not be null. + */ + public InterpolatorProperty( String key, String value ) + { + this(key, value, null); + } + + public InterpolatorProperty( String key, String value, String tag ) + { + if ( key == null ) + { + throw new IllegalArgumentException( "key: null" ); + } + + if ( value == null ) + { + throw new IllegalArgumentException( "value: null" ); + } + this.key = key; + this.value = value; + this.tag = tag; + + } + + /** + * Returns key (or name) of property. + * + * @return key (or name) of property + */ + public String getKey() + { + return key; + } + + /** + * Returns value of property. + * + * @return value of property + */ + public String getValue() + { + return value; + } + + public String getTag() + { + return tag; + } + + public void setTag(String tag) + { + this.tag = tag; + } + public static List<InterpolatorProperty> toInterpolatorProperties( Map<String, String> properties, String tag ) + { + if( properties == null ) + { + throw new IllegalArgumentException( "properties: null" ); + } + + List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>(); + for ( Map.Entry<String, String> e : properties.entrySet() ) + { + interpolatorProperties.add( new InterpolatorProperty( "${" + e.getKey() +"}", e.getValue(), tag) ); + } + return interpolatorProperties; + } + + /** + * Returns true if key values match, otherwise returns false. + * + * @param o interpolator property to compare + * @return true if key values match, otherwise returns false + */ + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + if ( o == null || getClass() != o.getClass() ) + { + return false; + } + + InterpolatorProperty that = (InterpolatorProperty) o; + + if ( !key.equals( that.key ) ) + { + return false; + } + + return true; + } + + /** + * Returns hash code of interpolator property key. + * + * @return hash code of interpolator property key + */ + public int hashCode() + { + return key.hashCode(); + } + + public String toString() + { + return "Key = " + key + ", Value = " + value + ", Hash = " + + this.hashCode(); + } + + public static List<InterpolatorProperty> toInterpolatorProperties( Properties properties, String tag ) + { + if( properties == null ) + { + throw new IllegalArgumentException( "properties: null" ); + } + + List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>(); + for ( Map.Entry<Object, Object> e : properties.entrySet() ) + { + interpolatorProperties.add( new InterpolatorProperty( "${" + e.getKey() +"}", (String) e.getValue(), tag) ); + } + return interpolatorProperties; + } +} + Copied: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ModelProperty.java (from r766081, maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/ModelProperty.java) URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ModelProperty.java?p2=maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ModelProperty.java&p1=maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/ModelProperty.java&r1=766081&r2=766088&rev=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/project/builder/ModelProperty.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/ModelProperty.java Fri Apr 17 17:16:55 2009 @@ -1,4 +1,4 @@ -package org.apache.maven.project.builder; +package org.apache.maven.model.interpolator; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -24,10 +24,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; + /** * Maps a URI to a string value, which may be null. This class is immutable. */ -public final class ModelProperty +final class ModelProperty { /** Added: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/PomInterpolatorTag.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/PomInterpolatorTag.java?rev=766088&view=auto ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/PomInterpolatorTag.java (added) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolator/PomInterpolatorTag.java Fri Apr 17 17:16:55 2009 @@ -0,0 +1,12 @@ +package org.apache.maven.model.interpolator; + + +public enum PomInterpolatorTag +{ + + USER_PROPERTIES, + + PROJECT_PROPERTIES, + + EXECUTION_PROPERTIES +} Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java Fri Apr 17 17:16:55 2009 @@ -22,6 +22,8 @@ import org.apache.maven.model.Activation; import org.apache.maven.model.Model; import org.apache.maven.model.Profile; +import org.apache.maven.model.interpolator.InterpolatorProperty; +import org.apache.maven.model.interpolator.PomInterpolatorTag; import org.apache.maven.profiles.ProfileActivationContext; import org.apache.maven.profiles.ProfileActivationException; import org.apache.maven.profiles.ProfileManager; @@ -30,8 +32,6 @@ import org.apache.maven.profiles.matchers.JdkMatcher; import org.apache.maven.profiles.matchers.ProfileMatcher; import org.apache.maven.profiles.matchers.PropertyMatcher; -import org.apache.maven.project.builder.InterpolatorProperty; -import org.apache.maven.project.builder.PomInterpolatorTag; import java.util.ArrayList; import java.util.Arrays; Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/ProfileManagerInfo.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/ProfileManagerInfo.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/ProfileManagerInfo.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/ProfileManagerInfo.java Fri Apr 17 17:16:55 2009 @@ -4,7 +4,7 @@ import java.util.Collection; import java.util.List; -import org.apache.maven.project.builder.InterpolatorProperty; +import org.apache.maven.model.interpolator.InterpolatorProperty; public class ProfileManagerInfo { Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/DefaultMatcher.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/DefaultMatcher.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/DefaultMatcher.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/DefaultMatcher.java Fri Apr 17 17:16:55 2009 @@ -22,7 +22,7 @@ import java.util.List; import org.apache.maven.model.Profile; -import org.apache.maven.project.builder.InterpolatorProperty; +import org.apache.maven.model.interpolator.InterpolatorProperty; public class DefaultMatcher implements ProfileMatcher { Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/FileMatcher.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/FileMatcher.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/FileMatcher.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/FileMatcher.java Fri Apr 17 17:16:55 2009 @@ -5,7 +5,7 @@ import org.apache.maven.model.ActivationFile; import org.apache.maven.model.Profile; -import org.apache.maven.project.builder.InterpolatorProperty; +import org.apache.maven.model.interpolator.InterpolatorProperty; public class FileMatcher implements ProfileMatcher { Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/JdkMatcher.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/JdkMatcher.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/JdkMatcher.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/JdkMatcher.java Fri Apr 17 17:16:55 2009 @@ -5,7 +5,7 @@ import java.util.List; import org.apache.maven.model.Profile; -import org.apache.maven.project.builder.InterpolatorProperty; +import org.apache.maven.model.interpolator.InterpolatorProperty; public class JdkMatcher implements ProfileMatcher Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/ProfileMatcher.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/ProfileMatcher.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/ProfileMatcher.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/ProfileMatcher.java Fri Apr 17 17:16:55 2009 @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.maven.project.builder.InterpolatorProperty; import org.apache.maven.model.Profile; +import org.apache.maven.model.interpolator.InterpolatorProperty; public interface ProfileMatcher { Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/PropertyMatcher.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/PropertyMatcher.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/PropertyMatcher.java (original) +++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/profiles/matchers/PropertyMatcher.java Fri Apr 17 17:16:55 2009 @@ -22,7 +22,7 @@ import java.util.List; import org.apache.maven.model.Profile; -import org.apache.maven.project.builder.InterpolatorProperty; +import org.apache.maven.model.interpolator.InterpolatorProperty; public class PropertyMatcher implements ProfileMatcher { Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original) +++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Fri Apr 17 17:16:55 2009 @@ -38,19 +38,19 @@ import org.apache.maven.model.Build; import org.apache.maven.model.Model; import org.apache.maven.model.Profile; +import org.apache.maven.model.interpolator.DefaultInterpolator; +import org.apache.maven.model.interpolator.Interpolator; +import org.apache.maven.model.interpolator.InterpolatorProperty; +import org.apache.maven.model.interpolator.PomInterpolatorTag; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.profiles.DefaultProfileManager; import org.apache.maven.profiles.ProfileActivationException; import org.apache.maven.profiles.ProfileManagerInfo; 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; -import org.apache.maven.project.builder.PomInterpolatorTag; import org.apache.maven.project.builder.ProcessorContext; import org.apache.maven.project.validation.ModelValidationResult; import org.apache.maven.project.validation.ModelValidator; Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/matchers/JdkMatcherTest.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/matchers/JdkMatcherTest.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/matchers/JdkMatcherTest.java (original) +++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/matchers/JdkMatcherTest.java Fri Apr 17 17:16:55 2009 @@ -4,7 +4,7 @@ import org.apache.maven.model.Activation; import org.apache.maven.model.Profile; -import org.apache.maven.project.builder.InterpolatorProperty; +import org.apache.maven.model.interpolator.InterpolatorProperty; import junit.framework.TestCase; Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java?rev=766088&r1=766087&r2=766088&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java (original) +++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java Fri Apr 17 17:16:55 2009 @@ -20,22 +20,13 @@ */ import java.io.*; -import java.util.HashMap; import java.util.Iterator; -import java.util.List; -import java.util.Map; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.jxpath.JXPathNotFoundException; import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl; -import org.apache.maven.model.Model; -import org.apache.maven.model.io.xpp3.MavenXpp3Writer; -import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.project.builder.ModelProperty; import org.apache.maven.project.builder.PomClassicDomainModel; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.WriterFactory; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; public class PomTestWrapper {