mirror of https://github.com/apache/maven.git
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:
parent
1f5a668726
commit
6a1f04705c
|
@ -7,7 +7,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||||
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
|
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
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.resolver.MultipleArtifactsNotFoundException;
|
||||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
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.MavenProject;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
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.MavenExecutionException;
|
||||||
import org.apache.maven.reactor.MissingModuleException;
|
import org.apache.maven.reactor.MissingModuleException;
|
||||||
import org.apache.maven.realm.RealmManagementException;
|
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.configuration.PlexusConfiguration;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface CoreErrorReporter
|
public interface CoreErrorReporter
|
||||||
extends ProjectErrorReporter
|
extends ProjectErrorReporter
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.apache.maven.errors;
|
||||||
|
|
||||||
import org.apache.maven.NoGoalsSpecifiedException;
|
import org.apache.maven.NoGoalsSpecifiedException;
|
||||||
import org.apache.maven.ProjectCycleException;
|
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.Artifact;
|
||||||
import org.apache.maven.artifact.ArtifactUtils;
|
import org.apache.maven.artifact.ArtifactUtils;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.maven.plugin;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.ArtifactFilterManager;
|
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.shared.model.InterpolatorProperty;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
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.ExpressionEvaluationException;
|
||||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
|
@ -205,8 +205,8 @@ under the License.
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
<role>org.apache.maven.path.PathTranslator</role>
|
<role>org.apache.maven.project.path.PathTranslator</role>
|
||||||
<implementation>org.apache.maven.path.DefaultPathTranslator</implementation>
|
<implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
|
@ -224,7 +224,7 @@ under the License.
|
||||||
<role>org.apache.maven.ArtifactFilterManager</role>
|
<role>org.apache.maven.ArtifactFilterManager</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.path.PathTranslator</role>
|
<role>org.apache.maven.project.path.PathTranslator</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.plugin.MavenPluginCollector</role>
|
<role>org.apache.maven.plugin.MavenPluginCollector</role>
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.execution.DuplicateProjectException;
|
import org.apache.maven.execution.DuplicateProjectException;
|
||||||
import org.apache.maven.project.MavenProject;
|
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.apache.maven.settings.Settings;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
|
|
@ -30,7 +30,7 @@ under the License.
|
||||||
<role>org.apache.maven.project.validation.ModelValidator</role>
|
<role>org.apache.maven.project.validation.ModelValidator</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.path.PathTranslator</role>
|
<role>org.apache.maven.project.path.PathTranslator</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||||
|
|
|
@ -41,10 +41,7 @@ import org.apache.maven.profiles.activation.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||||
import org.apache.maven.profiles.build.ProfileAdvisor;
|
import org.apache.maven.profiles.build.ProfileAdvisor;
|
||||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
||||||
import org.apache.maven.project.builder.PomArtifactResolver;
|
import org.apache.maven.project.builder.*;
|
||||||
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.validation.ModelValidationResult;
|
import org.apache.maven.project.validation.ModelValidationResult;
|
||||||
import org.apache.maven.project.validation.ModelValidator;
|
import org.apache.maven.project.validation.ModelValidator;
|
||||||
import org.codehaus.plexus.logging.LogEnabled;
|
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.IOUtil;
|
||||||
import org.codehaus.plexus.util.ReaderFactory;
|
import org.codehaus.plexus.util.ReaderFactory;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.WriterFactory;
|
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -61,7 +57,6 @@ import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.Writer;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -134,7 +129,7 @@ public class DefaultMavenProjectBuilder
|
||||||
getSuperProject( config, projectDescriptor, true ).getModel() ), artifactResolver ), config );
|
getSuperProject( config, projectDescriptor, true ).getModel() ), artifactResolver ), config );
|
||||||
|
|
||||||
project.setFile( projectDescriptor );
|
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();
|
Build build = project.getBuild();
|
||||||
// NOTE: setting this script-source root before path translation, because
|
// 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() ) );
|
artifactRepositories.addAll( repositoryHelper.buildArtifactRepositories( getSuperProject( config, artifact.getFile(), false ).getModel() ) );
|
||||||
|
|
||||||
project = readModelFromLocalPath( "unknown", artifact.getFile(), new PomArtifactResolver( config.getLocalRepository(), artifactRepositories, artifactResolver ), config );
|
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 );
|
artifact.setFile( f );
|
||||||
project.setVersion( artifact.getVersion() );
|
project.setVersion( artifact.getVersion() );
|
||||||
|
|
||||||
|
@ -352,7 +347,7 @@ public class DefaultMavenProjectBuilder
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MavenProject buildInternal( Model model, ProjectBuilderConfiguration config, File projectDescriptor,
|
private MavenProject buildWithProfiles( Model model, ProjectBuilderConfiguration config, File projectDescriptor,
|
||||||
File parentDescriptor, boolean isReactorProject )
|
File parentDescriptor, boolean isReactorProject )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
|
|
|
@ -746,6 +746,11 @@ public final class PomClassicTransformer
|
||||||
return false;
|
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/
|
* Returns the base uri of all model properties: http://apache.org/maven/project/
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.maven.path;
|
package org.apache.maven.project.path;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.maven.path;
|
package org.apache.maven.project.path;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.maven.path;
|
package org.apache.maven.project.path;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.List;
|
||||||
public interface ModelTransformer
|
public interface ModelTransformer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
List<ModelProperty> preprocessModelProperties(List<ModelProperty> modelProperties);
|
||||||
|
|
||||||
String getBaseUri();
|
String getBaseUri();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -233,6 +233,7 @@ public final class ModelTransformerContext
|
||||||
|
|
||||||
List<ModelProperty> transformedProperties =
|
List<ModelProperty> transformedProperties =
|
||||||
importModelProperties(importModels, fromModelTransformer.transformToModelProperties( domainModels));
|
importModelProperties(importModels, fromModelTransformer.transformToModelProperties( domainModels));
|
||||||
|
transformedProperties = fromModelTransformer.preprocessModelProperties(transformedProperties);
|
||||||
|
|
||||||
String baseUriForModel = fromModelTransformer.getBaseUri();
|
String baseUriForModel = fromModelTransformer.getBaseUri();
|
||||||
List<ModelProperty> modelProperties =
|
List<ModelProperty> modelProperties =
|
||||||
|
|
Loading…
Reference in New Issue