diff --git a/apache-maven/src/main/assembly/bin.xml b/apache-maven/src/main/assembly/bin.xml index c89331a41f..dd106a8433 100644 --- a/apache-maven/src/main/assembly/bin.xml +++ b/apache-maven/src/main/assembly/bin.xml @@ -20,8 +20,6 @@ under the License. bin - tar.gz - tar.bz2 zip diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index f5dee0a39a..5b7fad3a69 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -37,8 +37,8 @@ import org.apache.maven.model.building.ModelBuildingException; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelBuildingResult; import org.apache.maven.model.building.ModelProblem; +import org.apache.maven.model.building.ModelProcessor; import org.apache.maven.model.building.UrlModelSource; -import org.apache.maven.model.locator.ModelLocator; import org.apache.maven.model.resolution.ModelResolver; import org.apache.maven.project.artifact.ProjectArtifact; import org.apache.maven.repository.RepositorySystem; @@ -59,7 +59,7 @@ public class DefaultProjectBuilder private ModelBuilder modelBuilder; @Requirement - private ModelLocator modelLocator; + private ModelProcessor modelProcessor; @Requirement private ProjectBuildingHelper projectBuildingHelper; @@ -344,7 +344,7 @@ public class DefaultProjectBuilder if ( moduleFile.isDirectory() ) { - moduleFile = modelLocator.locatePom( moduleFile ); + moduleFile = modelProcessor.locatePom( moduleFile ); } if ( !moduleFile.isFile() ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index b5dafdb6e5..2869f1a0dc 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -36,6 +36,7 @@ import org.apache.maven.execution.MavenExecutionRequestPopulationException; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequestPopulator; import org.apache.maven.execution.MavenExecutionResult; +import org.apache.maven.model.building.ModelProcessor; import org.apache.maven.model.locator.ModelLocator; import org.apache.maven.repository.ArtifactTransferListener; import org.apache.maven.settings.Settings; @@ -48,6 +49,7 @@ import org.apache.maven.settings.building.SettingsProblem; import org.codehaus.plexus.ContainerConfiguration; import org.codehaus.plexus.DefaultContainerConfiguration; import org.codehaus.plexus.DefaultPlexusContainer; +import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainerException; import org.codehaus.plexus.classworlds.ClassWorld; import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; @@ -83,7 +85,7 @@ public class MavenCli private PrintStreamLogger logger; - private ModelLocator modelLocator; + private ModelProcessor modelProcessor; public static void main( String[] args ) { @@ -127,8 +129,14 @@ public class MavenCli logger = new PrintStreamLogger( System.out ); container.setLoggerManager( new MavenLoggerManager( logger ) ); + + customizeContainer( container ); } + protected void customizeContainer( PlexusContainer container ) + { + } + public int doMain( String[] args, String workingDirectory, PrintStream stdout, PrintStream stderr ) { if ( stdout == null ) @@ -225,7 +233,7 @@ public class MavenCli { maven = container.lookup( Maven.class ); - modelLocator = container.lookup( ModelLocator.class ); + modelProcessor = createModelProcessor( container ); } catch ( ComponentLookupException e ) { @@ -490,6 +498,12 @@ public class MavenCli } } + protected ModelProcessor createModelProcessor( PlexusContainer container ) + throws ComponentLookupException + { + return container.lookup( ModelProcessor.class ); + } + private Configuration buildEmbedderConfiguration( CommandLine commandLine, String workingDirectory ) { File userSettingsFile; @@ -741,7 +755,7 @@ public class MavenCli } else if ( ( request.getPom() == null ) && ( request.getBaseDirectory() != null ) ) { - File pom = modelLocator.locatePom( new File( request.getBaseDirectory() ) ); + File pom = modelProcessor.locatePom( new File( request.getBaseDirectory() ) ); request.setPom( pom ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index b0b99f1892..9c151f789b 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -39,8 +39,6 @@ import org.apache.maven.model.composition.DependencyManagementImporter; import org.apache.maven.model.inheritance.InheritanceAssembler; import org.apache.maven.model.interpolation.ModelInterpolator; import org.apache.maven.model.io.ModelParseException; -import org.apache.maven.model.io.ModelReader; -import org.apache.maven.model.locator.ModelLocator; import org.apache.maven.model.management.DependencyManagementInjector; import org.apache.maven.model.management.PluginManagementInjector; import org.apache.maven.model.normalization.ModelNormalizer; @@ -67,12 +65,8 @@ import org.codehaus.plexus.component.annotations.Requirement; public class DefaultModelBuilder implements ModelBuilder { - @Requirement - private ModelLocator modelLocator; - - @Requirement - private ModelReader modelReader; + private ModelProcessor modelProcessor; @Requirement private ModelValidator modelValidator; @@ -304,9 +298,9 @@ public class DefaultModelBuilder { boolean strict = request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0; - Map options = Collections.singletonMap( ModelReader.IS_STRICT, Boolean.valueOf( strict ) ); + Map options = Collections.singletonMap( ModelProcessor.IS_STRICT, Boolean.valueOf( strict ) ); - model = modelReader.read( modelSource.getInputStream(), options ); + model = modelProcessor.read( modelSource.getInputStream(), options ); } catch ( ModelParseException e ) { @@ -523,7 +517,7 @@ public class DefaultModelBuilder if ( pomFile.isDirectory() ) { - pomFile = modelLocator.locatePom( pomFile ); + pomFile = modelProcessor.locatePom( pomFile ); } return pomFile; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java index 5dcd53558c..ddd63d77a0 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java @@ -21,8 +21,11 @@ package org.apache.maven.model.superpom; import java.io.IOException; import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; import org.apache.maven.model.Model; +import org.apache.maven.model.building.ModelProcessor; import org.apache.maven.model.io.ModelReader; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; @@ -43,7 +46,7 @@ public class DefaultSuperPomProvider private Model superModel; @Requirement - private ModelReader modelReader; + private ModelProcessor modelProcessor; public Model getSuperModel( String version ) { @@ -61,7 +64,9 @@ public class DefaultSuperPomProvider try { - superModel = modelReader.read( is, null ); + Map options = new HashMap(); + options.put( "xml:4.0.0", "xml:4.0.0" ); + superModel = modelProcessor.read( is, options ); } catch ( IOException e ) {