o changes to allow polyglot maven to work

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@824607 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-10-13 06:49:25 +00:00
parent 4f81e046ff
commit 787008b34a
5 changed files with 31 additions and 20 deletions

View File

@ -20,8 +20,6 @@ under the License.
<assembly>
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<dependencySets>

View File

@ -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() )

View File

@ -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 );
}

View File

@ -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<String, ?> options = Collections.singletonMap( ModelReader.IS_STRICT, Boolean.valueOf( strict ) );
Map<String, ?> 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;

View File

@ -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<String,String> options = new HashMap<String,String>();
options.put( "xml:4.0.0", "xml:4.0.0" );
superModel = modelProcessor.read( is, options );
}
catch ( IOException e )
{