Moved PathTranslator back to project module to fix class reference issue with the enforcer plugin. Added a preprocess method on the ModelTransformer to allow processing of plugin config elements. Need to add information about which elements are collections so they are not lost during a sort.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@719406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-11-20 22:19:34 +00:00
parent 1f5a668726
commit 6a1f04705c
14 changed files with 25 additions and 25 deletions

View File

@ -7,7 +7,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@ -35,7 +34,7 @@ import org.apache.maven.project.DuplicateArtifactAttachmentException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.path.PathTranslator;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.reactor.MavenExecutionException;
import org.apache.maven.reactor.MissingModuleException;
import org.apache.maven.realm.RealmManagementException;
@ -44,9 +43,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.logging.Logger;
import java.io.File;
import java.util.List;
import java.util.Map;
public interface CoreErrorReporter
extends ProjectErrorReporter

View File

@ -2,7 +2,7 @@ package org.apache.maven.errors;
import org.apache.maven.NoGoalsSpecifiedException;
import org.apache.maven.ProjectCycleException;
import org.apache.maven.path.PathTranslator;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;

View File

@ -20,7 +20,7 @@ package org.apache.maven.plugin;
*/
import org.apache.maven.ArtifactFilterManager;
import org.apache.maven.path.PathTranslator;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.shared.model.InterpolatorProperty;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;

View File

@ -23,7 +23,7 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.path.PathTranslator;
import org.apache.maven.project.path.PathTranslator;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.logging.Logger;

View File

@ -205,8 +205,8 @@ under the License.
</component>
<component>
<role>org.apache.maven.path.PathTranslator</role>
<implementation>org.apache.maven.path.DefaultPathTranslator</implementation>
<role>org.apache.maven.project.path.PathTranslator</role>
<implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
</component>
<component>
@ -224,7 +224,7 @@ under the License.
<role>org.apache.maven.ArtifactFilterManager</role>
</requirement>
<requirement>
<role>org.apache.maven.path.PathTranslator</role>
<role>org.apache.maven.project.path.PathTranslator</role>
</requirement>
<requirement>
<role>org.apache.maven.plugin.MavenPluginCollector</role>

View File

@ -35,7 +35,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.execution.DuplicateProjectException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.path.PathTranslator;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusTestCase;

View File

@ -30,7 +30,7 @@ under the License.
<role>org.apache.maven.project.validation.ModelValidator</role>
</requirement>
<requirement>
<role>org.apache.maven.path.PathTranslator</role>
<role>org.apache.maven.project.path.PathTranslator</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>

View File

@ -41,10 +41,7 @@ import org.apache.maven.profiles.activation.ProfileActivationContext;
import org.apache.maven.profiles.activation.ProfileActivationException;
import org.apache.maven.profiles.build.ProfileAdvisor;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.builder.PomArtifactResolver;
import org.apache.maven.project.builder.ProjectBuilder;
import org.apache.maven.project.builder.PomInterpolatorTag;
import org.apache.maven.project.builder.PomClassicTransformer;
import org.apache.maven.project.builder.*;
import org.apache.maven.project.validation.ModelValidationResult;
import org.apache.maven.project.validation.ModelValidator;
import org.codehaus.plexus.logging.LogEnabled;
@ -53,7 +50,6 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File;
@ -61,7 +57,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;
import java.net.URL;
import java.util.*;
import java.text.SimpleDateFormat;
@ -134,7 +129,7 @@ public class DefaultMavenProjectBuilder
getSuperProject( config, projectDescriptor, true ).getModel() ), artifactResolver ), config );
project.setFile( projectDescriptor );
project = buildInternal( project.getModel(), config, projectDescriptor, project.getParentFile(), true );
project = buildWithProfiles( project.getModel(), config, projectDescriptor, project.getParentFile(), true );
Build build = project.getBuild();
// NOTE: setting this script-source root before path translation, because
@ -193,8 +188,8 @@ public class DefaultMavenProjectBuilder
artifactRepositories.addAll( repositoryHelper.buildArtifactRepositories( getSuperProject( config, artifact.getFile(), false ).getModel() ) );
project = readModelFromLocalPath( "unknown", artifact.getFile(), new PomArtifactResolver( config.getLocalRepository(), artifactRepositories, artifactResolver ), config );
project = buildInternal( project.getModel(), config, artifact.getFile(), project.getParentFile(), false );
project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile(), false );
// project = readModelFromLocalPath( "unknown", artifact.getFile(), new PomArtifactResolver( config.getLocalRepository(), artifactRepositories, artifactResolver ), config );
artifact.setFile( f );
project.setVersion( artifact.getVersion() );
@ -352,7 +347,7 @@ public class DefaultMavenProjectBuilder
return logger;
}
private MavenProject buildInternal( Model model, ProjectBuilderConfiguration config, File projectDescriptor,
private MavenProject buildWithProfiles( Model model, ProjectBuilderConfiguration config, File projectDescriptor,
File parentDescriptor, boolean isReactorProject )
throws ProjectBuildingException
{

View File

@ -746,6 +746,11 @@ public final class PomClassicTransformer
return false;
}
public List<ModelProperty> preprocessModelProperties(List<ModelProperty> modelProperties)
{
return new ArrayList<ModelProperty>(modelProperties);
}
/**
* Returns the base uri of all model properties: http://apache.org/maven/project/
*

View File

@ -1,4 +1,4 @@
package org.apache.maven.path;
package org.apache.maven.project.path;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.path;
package org.apache.maven.project.path;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.maven.path;
package org.apache.maven.project.path;
import java.io.File;

View File

@ -30,6 +30,8 @@ import java.util.List;
public interface ModelTransformer
{
List<ModelProperty> preprocessModelProperties(List<ModelProperty> modelProperties);
String getBaseUri();
/**

View File

@ -233,6 +233,7 @@ public final class ModelTransformerContext
List<ModelProperty> transformedProperties =
importModelProperties(importModels, fromModelTransformer.transformToModelProperties( domainModels));
transformedProperties = fromModelTransformer.preprocessModelProperties(transformedProperties);
String baseUriForModel = fromModelTransformer.getBaseUri();
List<ModelProperty> modelProperties =