mirror of https://github.com/apache/maven.git
o Made ProjectBuilder use ProjectBuildingRequest for naming consistency within API
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@780115 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8c9c57652e
commit
ae675f8157
|
@ -100,7 +100,7 @@ public class DefaultMaven
|
||||||
//TODO: We really need to get rid of this requirement in here. If we know there is no project present
|
//TODO: We really need to get rid of this requirement in here. If we know there is no project present
|
||||||
if ( projects.isEmpty() )
|
if ( projects.isEmpty() )
|
||||||
{
|
{
|
||||||
MavenProject project = projectBuilder.buildStandaloneSuperProject( request.getProjectBuildingConfiguration() );
|
MavenProject project = projectBuilder.buildStandaloneSuperProject( request.getProjectBuilderRequest() );
|
||||||
projects.put( ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project );
|
projects.put( ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project );
|
||||||
request.setProjectPresent( false );
|
request.setProjectPresent( false );
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class DefaultMaven
|
||||||
|
|
||||||
for ( File file : files )
|
for ( File file : files )
|
||||||
{
|
{
|
||||||
MavenProject project = projectBuilder.build( file, request.getProjectBuildingConfiguration() );
|
MavenProject project = projectBuilder.build( file, request.getProjectBuilderRequest() );
|
||||||
|
|
||||||
if ( ( project.getPrerequisites() != null ) && ( project.getPrerequisites().getMaven() != null ) )
|
if ( ( project.getPrerequisites() != null ) && ( project.getPrerequisites().getMaven() != null ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,8 +23,8 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
import org.apache.maven.project.DefaultProjectBuildingRequest;
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.wagon.events.TransferListener;
|
import org.apache.maven.wagon.events.TransferListener;
|
||||||
|
|
||||||
|
@ -232,9 +232,9 @@ public class DefaultMavenExecutionRequest
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectBuildingConfiguration( ProjectBuilderConfiguration projectBuildingConfiguration )
|
public void setProjectBuildingConfiguration( ProjectBuildingRequest projectBuildingConfiguration )
|
||||||
{
|
{
|
||||||
this.projectBuildingConfiguration = projectBuildingConfiguration;
|
this.projectBuilderRequest = projectBuildingConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getActiveProfiles()
|
public List<String> getActiveProfiles()
|
||||||
|
@ -617,7 +617,7 @@ public class DefaultMavenExecutionRequest
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
|
|
||||||
// calculated from request attributes.
|
// calculated from request attributes.
|
||||||
private ProjectBuilderConfiguration projectBuildingConfiguration;
|
private ProjectBuildingRequest projectBuilderRequest;
|
||||||
|
|
||||||
public MavenExecutionRequest setSettings( Settings settings )
|
public MavenExecutionRequest setSettings( Settings settings )
|
||||||
{
|
{
|
||||||
|
@ -706,21 +706,21 @@ public class DefaultMavenExecutionRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: this does not belong here.
|
//TODO: this does not belong here.
|
||||||
public ProjectBuilderConfiguration getProjectBuildingConfiguration()
|
public ProjectBuildingRequest getProjectBuilderRequest()
|
||||||
{
|
{
|
||||||
if ( projectBuildingConfiguration == null )
|
if ( projectBuilderRequest == null )
|
||||||
{
|
{
|
||||||
projectBuildingConfiguration = new DefaultProjectBuilderConfiguration();
|
projectBuilderRequest = new DefaultProjectBuildingRequest();
|
||||||
projectBuildingConfiguration.setLocalRepository( getLocalRepository() );
|
projectBuilderRequest.setLocalRepository( getLocalRepository() );
|
||||||
projectBuildingConfiguration.setExecutionProperties( getProperties() );
|
projectBuilderRequest.setExecutionProperties( getProperties() );
|
||||||
projectBuildingConfiguration.setRemoteRepositories( getRemoteRepositories() );
|
projectBuilderRequest.setRemoteRepositories( getRemoteRepositories() );
|
||||||
projectBuildingConfiguration.setActiveProfileIds( getActiveProfiles() );
|
projectBuilderRequest.setActiveProfileIds( getActiveProfiles() );
|
||||||
projectBuildingConfiguration.setInactiveProfileIds( getInactiveProfiles() );
|
projectBuilderRequest.setInactiveProfileIds( getInactiveProfiles() );
|
||||||
projectBuildingConfiguration.setProfiles( getProfiles() );
|
projectBuilderRequest.setProfiles( getProfiles() );
|
||||||
projectBuildingConfiguration.setProcessPlugins( true );
|
projectBuilderRequest.setProcessPlugins( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
return projectBuildingConfiguration;
|
return projectBuilderRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenExecutionRequest addProfile( Profile profile )
|
public MavenExecutionRequest addProfile( Profile profile )
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Properties;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.wagon.events.TransferListener;
|
import org.apache.maven.wagon.events.TransferListener;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
@ -202,5 +202,5 @@ public interface MavenExecutionRequest
|
||||||
File getUserToolchainsFile();
|
File getUserToolchainsFile();
|
||||||
MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
|
MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
|
||||||
|
|
||||||
ProjectBuilderConfiguration getProjectBuildingConfiguration();
|
ProjectBuildingRequest getProjectBuilderRequest();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Properties;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
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.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
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.util.dag.CycleDetectedException;
|
import org.codehaus.plexus.util.dag.CycleDetectedException;
|
||||||
|
@ -132,9 +132,9 @@ public class MavenSession
|
||||||
return currentProject;
|
return currentProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuilderConfiguration getProjectBuilderConfiguration()
|
public ProjectBuildingRequest getProjectBuilderRequest()
|
||||||
{
|
{
|
||||||
return request.getProjectBuildingConfiguration();
|
return request.getProjectBuilderRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getPluginGroups()
|
public List<String> getPluginGroups()
|
||||||
|
|
|
@ -19,16 +19,10 @@ import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.ArtifactUtils;
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
import org.apache.maven.project.artifact.ProjectArtifact;
|
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -41,9 +35,6 @@ public class DefaultMavenProjectBuilder
|
||||||
@Requirement
|
@Requirement
|
||||||
private ProjectBuilder projectBuilder;
|
private ProjectBuilder projectBuilder;
|
||||||
|
|
||||||
@Requirement
|
|
||||||
private RepositorySystem repositorySystem;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// MavenProjectBuilder Implementation
|
// MavenProjectBuilder Implementation
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -101,50 +92,7 @@ public class DefaultMavenProjectBuilder
|
||||||
public MavenProjectBuildingResult buildProjectWithDependencies( File pomFile, ProjectBuilderConfiguration configuration )
|
public MavenProjectBuildingResult buildProjectWithDependencies( File pomFile, ProjectBuilderConfiguration configuration )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
MavenProject project = projectBuilder.build( pomFile, configuration );
|
return projectBuilder.buildProjectWithDependencies( pomFile, configuration );
|
||||||
|
|
||||||
Artifact artifact = new ProjectArtifact( project );
|
|
||||||
|
|
||||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
|
|
||||||
.setArtifact( artifact )
|
|
||||||
.setResolveRoot( false )
|
|
||||||
.setResolveTransitively( true )
|
|
||||||
.setLocalRepository( configuration.getLocalRepository() )
|
|
||||||
.setRemoteRepostories( project.getRemoteArtifactRepositories() )
|
|
||||||
.setManagedVersionMap( project.getManagedVersionMap() );
|
|
||||||
|
|
||||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
|
||||||
|
|
||||||
if ( result.hasExceptions() )
|
|
||||||
{
|
|
||||||
Exception e = result.getExceptions().get( 0 );
|
|
||||||
|
|
||||||
throw new ProjectBuildingException( safeVersionlessKey( project.getGroupId(), project.getArtifactId() ), "Unable to build project due to an invalid dependency version: " + e.getMessage(),
|
|
||||||
pomFile, e );
|
|
||||||
}
|
|
||||||
|
|
||||||
project.setArtifacts( result.getArtifacts() );
|
|
||||||
|
|
||||||
return new MavenProjectBuildingResult( project, result );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String safeVersionlessKey( String groupId, String artifactId )
|
|
||||||
{
|
|
||||||
String gid = groupId;
|
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( gid ) )
|
|
||||||
{
|
|
||||||
gid = "unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
String aid = artifactId;
|
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( aid ) )
|
|
||||||
{
|
|
||||||
aid = "unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
return ArtifactUtils.versionlessKey( gid, aid );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -50,6 +50,7 @@ import org.apache.maven.model.profile.ProfileInjector;
|
||||||
import org.apache.maven.model.profile.ProfileSelector;
|
import org.apache.maven.model.profile.ProfileSelector;
|
||||||
import org.apache.maven.model.validation.ModelValidationResult;
|
import org.apache.maven.model.validation.ModelValidationResult;
|
||||||
import org.apache.maven.model.validation.ModelValidator;
|
import org.apache.maven.model.validation.ModelValidator;
|
||||||
|
import org.apache.maven.project.artifact.ProjectArtifact;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
@ -114,13 +115,13 @@ public class DefaultProjectBuilder
|
||||||
// MavenProjectBuilder Implementation
|
// MavenProjectBuilder Implementation
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
public MavenProject build( File pomFile, ProjectBuilderConfiguration configuration )
|
public MavenProject build( File pomFile, ProjectBuildingRequest configuration )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
return build( pomFile, pomFile.getParentFile(), configuration );
|
return build( pomFile, pomFile.getParentFile(), configuration );
|
||||||
}
|
}
|
||||||
|
|
||||||
private MavenProject build( File pomFile, File projectDirectory, ProjectBuilderConfiguration configuration )
|
private MavenProject build( File pomFile, File projectDirectory, ProjectBuildingRequest configuration )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
String cacheKey = getCacheKey( pomFile, configuration );
|
String cacheKey = getCacheKey( pomFile, configuration );
|
||||||
|
@ -225,7 +226,7 @@ public class DefaultProjectBuilder
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCacheKey( File pomFile, ProjectBuilderConfiguration configuration )
|
private String getCacheKey( File pomFile, ProjectBuildingRequest configuration )
|
||||||
{
|
{
|
||||||
StringBuilder buffer = new StringBuilder( 256 );
|
StringBuilder buffer = new StringBuilder( 256 );
|
||||||
buffer.append( pomFile.getAbsolutePath() );
|
buffer.append( pomFile.getAbsolutePath() );
|
||||||
|
@ -233,7 +234,7 @@ public class DefaultProjectBuilder
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenProject build( Artifact artifact, ProjectBuilderConfiguration configuration )
|
public MavenProject build( Artifact artifact, ProjectBuildingRequest configuration )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
if ( !artifact.getType().equals( "pom" ) )
|
if ( !artifact.getType().equals( "pom" ) )
|
||||||
|
@ -266,7 +267,7 @@ public class DefaultProjectBuilder
|
||||||
* I am taking out the profile handling and the interpolation of the base directory until we
|
* I am taking out the profile handling and the interpolation of the base directory until we
|
||||||
* spec this out properly.
|
* spec this out properly.
|
||||||
*/
|
*/
|
||||||
public MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration config )
|
public MavenProject buildStandaloneSuperProject( ProjectBuildingRequest config )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
if ( superProject != null )
|
if ( superProject != null )
|
||||||
|
@ -290,7 +291,37 @@ public class DefaultProjectBuilder
|
||||||
return superProject;
|
return superProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model interpolateModel( Model model, ProjectBuilderConfiguration config, File projectDescriptor )
|
public MavenProjectBuildingResult buildProjectWithDependencies( File pomFile, ProjectBuildingRequest request )
|
||||||
|
throws ProjectBuildingException
|
||||||
|
{
|
||||||
|
MavenProject project = build( pomFile, request );
|
||||||
|
|
||||||
|
Artifact artifact = new ProjectArtifact( project );
|
||||||
|
|
||||||
|
ArtifactResolutionRequest artifactRequest = new ArtifactResolutionRequest()
|
||||||
|
.setArtifact( artifact )
|
||||||
|
.setResolveRoot( false )
|
||||||
|
.setResolveTransitively( true )
|
||||||
|
.setLocalRepository( request.getLocalRepository() )
|
||||||
|
.setRemoteRepostories( project.getRemoteArtifactRepositories() )
|
||||||
|
.setManagedVersionMap( project.getManagedVersionMap() );
|
||||||
|
|
||||||
|
ArtifactResolutionResult result = repositorySystem.resolve( artifactRequest );
|
||||||
|
|
||||||
|
if ( result.hasExceptions() )
|
||||||
|
{
|
||||||
|
Exception e = result.getExceptions().get( 0 );
|
||||||
|
|
||||||
|
throw new ProjectBuildingException( safeVersionlessKey( project.getGroupId(), project.getArtifactId() ), "Unable to build project due to an invalid dependency version: " + e.getMessage(),
|
||||||
|
pomFile, e );
|
||||||
|
}
|
||||||
|
|
||||||
|
project.setArtifacts( result.getArtifacts() );
|
||||||
|
|
||||||
|
return new MavenProjectBuildingResult( project, result );
|
||||||
|
}
|
||||||
|
|
||||||
|
private Model interpolateModel( Model model, ProjectBuildingRequest config, File projectDescriptor )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -306,7 +337,7 @@ public class DefaultProjectBuilder
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MavenProject fromModelToMavenProject( Model model, File parentFile, ProjectBuilderConfiguration config, File projectDescriptor )
|
private MavenProject fromModelToMavenProject( Model model, File parentFile, ProjectBuildingRequest config, File projectDescriptor )
|
||||||
throws InvalidProjectModelException, IOException
|
throws InvalidProjectModelException, IOException
|
||||||
{
|
{
|
||||||
MavenProject project;
|
MavenProject project;
|
||||||
|
@ -329,7 +360,7 @@ public class DefaultProjectBuilder
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Model> build( String projectId, File pomFile, ProjectBuilderConfiguration projectBuilderConfiguration )
|
private List<Model> build( String projectId, File pomFile, ProjectBuildingRequest projectBuilderConfiguration )
|
||||||
throws ProjectBuildingException, IOException
|
throws ProjectBuildingException, IOException
|
||||||
{
|
{
|
||||||
Model mainModel = readModel( projectId, pomFile, !projectBuilderConfiguration.istLenientValidation() );
|
Model mainModel = readModel( projectId, pomFile, !projectBuilderConfiguration.istLenientValidation() );
|
||||||
|
@ -564,7 +595,7 @@ public class DefaultProjectBuilder
|
||||||
* @throws ProjectBuildingException
|
* @throws ProjectBuildingException
|
||||||
*/
|
*/
|
||||||
private List<Model> getDomainModelParentsFromLocalPath( Model model, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, File projectDirectory,
|
private List<Model> getDomainModelParentsFromLocalPath( Model model, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, File projectDirectory,
|
||||||
ProjectBuilderConfiguration projectBuilderConfiguration )
|
ProjectBuildingRequest projectBuilderConfiguration )
|
||||||
throws IOException, ProjectBuildingException
|
throws IOException, ProjectBuildingException
|
||||||
{
|
{
|
||||||
List<Model> models = new ArrayList<Model>();
|
List<Model> models = new ArrayList<Model>();
|
||||||
|
|
|
@ -0,0 +1,189 @@
|
||||||
|
package org.apache.maven.project;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.model.ModelEventListener;
|
||||||
|
import org.apache.maven.model.Profile;
|
||||||
|
|
||||||
|
public class DefaultProjectBuildingRequest
|
||||||
|
implements ProjectBuildingRequest
|
||||||
|
{
|
||||||
|
private ArtifactRepository localRepository;
|
||||||
|
|
||||||
|
private List<ArtifactRepository> remoteRepositories;
|
||||||
|
|
||||||
|
private Properties executionProperties;
|
||||||
|
|
||||||
|
private List<ModelEventListener> listeners;
|
||||||
|
|
||||||
|
private MavenProject topProject;
|
||||||
|
|
||||||
|
private boolean processPlugins = true;
|
||||||
|
|
||||||
|
private boolean lenientValidation;
|
||||||
|
|
||||||
|
private List<String> activeProfileIds;
|
||||||
|
|
||||||
|
private List<String> inactiveProfileIds;
|
||||||
|
|
||||||
|
private List<Profile> profiles;
|
||||||
|
|
||||||
|
public MavenProject getTopLevelProjectFromReactor()
|
||||||
|
{
|
||||||
|
return topProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTopLevelProjectForReactor(MavenProject mavenProject)
|
||||||
|
{
|
||||||
|
this.topProject = mavenProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository )
|
||||||
|
{
|
||||||
|
this.localRepository = localRepository;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactRepository getLocalRepository()
|
||||||
|
{
|
||||||
|
return localRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ArtifactRepository> getRemoteRepositories()
|
||||||
|
{
|
||||||
|
if ( remoteRepositories == null )
|
||||||
|
{
|
||||||
|
remoteRepositories = new ArrayList<ArtifactRepository>();
|
||||||
|
}
|
||||||
|
return remoteRepositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
|
||||||
|
{
|
||||||
|
this.remoteRepositories = remoteRepositories;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Properties getExecutionProperties()
|
||||||
|
{
|
||||||
|
if ( executionProperties == null )
|
||||||
|
{
|
||||||
|
executionProperties = new Properties();
|
||||||
|
}
|
||||||
|
return executionProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingRequest setExecutionProperties( Properties executionProperties )
|
||||||
|
{
|
||||||
|
this.executionProperties = executionProperties;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ModelEventListener> getModelEventListeners()
|
||||||
|
{
|
||||||
|
return listeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingRequest setModelEventListeners( List<ModelEventListener> listeners )
|
||||||
|
{
|
||||||
|
this.listeners = listeners;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isProcessPlugins()
|
||||||
|
{
|
||||||
|
return processPlugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingRequest setProcessPlugins( boolean processPlugins )
|
||||||
|
{
|
||||||
|
this.processPlugins = processPlugins;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingRequest setLenientValidation( boolean lenientValidation )
|
||||||
|
{
|
||||||
|
this.lenientValidation = lenientValidation;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean istLenientValidation()
|
||||||
|
{
|
||||||
|
return lenientValidation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getActiveProfileIds()
|
||||||
|
{
|
||||||
|
if ( activeProfileIds == null )
|
||||||
|
{
|
||||||
|
activeProfileIds = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
return activeProfileIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActiveProfileIds( List<String> activeProfileIds )
|
||||||
|
{
|
||||||
|
this.activeProfileIds = activeProfileIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getInactiveProfileIds()
|
||||||
|
{
|
||||||
|
if ( inactiveProfileIds == null )
|
||||||
|
{
|
||||||
|
inactiveProfileIds = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
return inactiveProfileIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInactiveProfileIds( List<String> inactiveProfileIds )
|
||||||
|
{
|
||||||
|
this.inactiveProfileIds = inactiveProfileIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfiles( List<Profile> profiles )
|
||||||
|
{
|
||||||
|
this.profiles = profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProfile( Profile profile )
|
||||||
|
{
|
||||||
|
if ( profiles == null )
|
||||||
|
{
|
||||||
|
profiles = new ArrayList<Profile>();
|
||||||
|
}
|
||||||
|
|
||||||
|
profiles.add( profile );
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Profile> getProfiles()
|
||||||
|
{
|
||||||
|
if ( profiles == null )
|
||||||
|
{
|
||||||
|
profiles = new ArrayList<Profile>();
|
||||||
|
}
|
||||||
|
return profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -153,7 +153,7 @@ public class MavenProject
|
||||||
|
|
||||||
private ProjectBuilder mavenProjectBuilder;
|
private ProjectBuilder mavenProjectBuilder;
|
||||||
|
|
||||||
private ProjectBuilderConfiguration projectBuilderConfiguration;
|
private ProjectBuildingRequest projectBuilderConfiguration;
|
||||||
|
|
||||||
private RepositorySystem repositorySystem;
|
private RepositorySystem repositorySystem;
|
||||||
//
|
//
|
||||||
|
@ -212,7 +212,7 @@ public class MavenProject
|
||||||
* @param projectBuilderConfiguration
|
* @param projectBuilderConfiguration
|
||||||
* @throws InvalidRepositoryException
|
* @throws InvalidRepositoryException
|
||||||
*/
|
*/
|
||||||
public MavenProject( Model model, RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder, ProjectBuilderConfiguration projectBuilderConfiguration )
|
public MavenProject( Model model, RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder, ProjectBuildingRequest projectBuilderConfiguration )
|
||||||
throws InvalidRepositoryException
|
throws InvalidRepositoryException
|
||||||
{
|
{
|
||||||
if ( model == null )
|
if ( model == null )
|
||||||
|
@ -291,7 +291,7 @@ public class MavenProject
|
||||||
{
|
{
|
||||||
for ( Iterator<String> it = modules.iterator(); it.hasNext(); )
|
for ( Iterator<String> it = modules.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
String modulePath = (String) it.next();
|
String modulePath = it.next();
|
||||||
String moduleName = modulePath;
|
String moduleName = modulePath;
|
||||||
|
|
||||||
if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) )
|
if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) )
|
||||||
|
@ -319,7 +319,7 @@ public class MavenProject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String) moduleAdjustments.get( module );
|
return moduleAdjustments.get( module );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -1672,7 +1672,7 @@ public class MavenProject
|
||||||
|
|
||||||
public Plugin getPlugin( String pluginKey )
|
public Plugin getPlugin( String pluginKey )
|
||||||
{
|
{
|
||||||
return (Plugin) getBuild().getPluginsAsMap().get( pluginKey );
|
return getBuild().getPluginsAsMap().get( pluginKey );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1904,7 +1904,7 @@ public class MavenProject
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
|
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
|
||||||
MavenProject project = (MavenProject) projectReferences.get( refId );
|
MavenProject project = projectReferences.get( refId );
|
||||||
|
|
||||||
boolean projectDirFound = false;
|
boolean projectDirFound = false;
|
||||||
if ( project != null )
|
if ( project != null )
|
||||||
|
|
|
@ -22,16 +22,22 @@ import org.apache.maven.artifact.Artifact;
|
||||||
public interface ProjectBuilder
|
public interface ProjectBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
MavenProject build( File projectFile, ProjectBuilderConfiguration configuration )
|
MavenProject build( File projectFile, ProjectBuildingRequest request )
|
||||||
throws ProjectBuildingException;
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
MavenProject build( Artifact projectArtifact, ProjectBuilderConfiguration configuration )
|
MavenProject build( Artifact projectArtifact, ProjectBuildingRequest request )
|
||||||
throws ProjectBuildingException;
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
// TODO: this is only to provide a project for plugins that don't need a project to execute but need some
|
// TODO: this is only to provide a project for plugins that don't need a project to execute but need some
|
||||||
// of the values from a MavenProject. Ideally this should be something internal and nothing outside Maven
|
// of the values from a MavenProject. Ideally this should be something internal and nothing outside Maven
|
||||||
// would ever need this so it should not be exposed in a public API
|
// would ever need this so it should not be exposed in a public API
|
||||||
MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration configuration )
|
MavenProject buildStandaloneSuperProject( ProjectBuildingRequest request )
|
||||||
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
|
// TODO: This also doesn't really belong here as it's a mix of project builder and artifact resolution and belongs
|
||||||
|
// in an integration component like the embedder.
|
||||||
|
@Deprecated
|
||||||
|
MavenProjectBuildingResult buildProjectWithDependencies( File project, ProjectBuildingRequest request )
|
||||||
throws ProjectBuildingException;
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,9 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.profile.ProfileActivationContext;
|
|
||||||
|
|
||||||
public interface ProjectBuilderConfiguration
|
public interface ProjectBuilderConfiguration
|
||||||
extends ProfileActivationContext
|
extends ProjectBuildingRequest
|
||||||
{
|
{
|
||||||
ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository );
|
ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository );
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package org.apache.maven.project;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.model.Profile;
|
||||||
|
import org.apache.maven.model.profile.ProfileActivationContext;
|
||||||
|
|
||||||
|
public interface ProjectBuildingRequest
|
||||||
|
extends ProfileActivationContext
|
||||||
|
{
|
||||||
|
ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
|
||||||
|
|
||||||
|
ArtifactRepository getLocalRepository();
|
||||||
|
|
||||||
|
ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
|
||||||
|
|
||||||
|
List<ArtifactRepository> getRemoteRepositories();
|
||||||
|
|
||||||
|
ProjectBuildingRequest setExecutionProperties( Properties executionProperties );
|
||||||
|
|
||||||
|
Properties getExecutionProperties();
|
||||||
|
|
||||||
|
void setTopLevelProjectForReactor(MavenProject mavenProject);
|
||||||
|
|
||||||
|
MavenProject getTopLevelProjectFromReactor();
|
||||||
|
|
||||||
|
ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
|
||||||
|
|
||||||
|
boolean isProcessPlugins();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
|
||||||
|
*
|
||||||
|
* @param lenientValidation A flag whether validation should be lenient instead of strict. For building of projects,
|
||||||
|
* strict validation should be used to ensure proper building. For the mere retrievel of dependencies
|
||||||
|
* during artifact resolution, lenient validation should be used to account for models of poor quality.
|
||||||
|
* @return This configuration, never {@code null}.
|
||||||
|
*/
|
||||||
|
ProjectBuildingRequest setLenientValidation( boolean lenientValidation );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the level of validation to perform on processed models.
|
||||||
|
*
|
||||||
|
* @return {@code true} if lenient validation is enabled and only the dependency information is to be validated,
|
||||||
|
* {@code false} if strict validation is enabled and the entire model is validated.
|
||||||
|
*/
|
||||||
|
boolean istLenientValidation();
|
||||||
|
|
||||||
|
// Profiles
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set any active profiles that the {@link ProjectBuilder} should consider while constructing
|
||||||
|
* a {@link MavenProject}.
|
||||||
|
*/
|
||||||
|
void setActiveProfileIds( List<String> activeProfileIds );
|
||||||
|
|
||||||
|
List<String> getActiveProfileIds();
|
||||||
|
|
||||||
|
void setInactiveProfileIds( List<String> inactiveProfileIds );
|
||||||
|
|
||||||
|
List<String> getInactiveProfileIds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration
|
||||||
|
* like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
|
||||||
|
* @param profile
|
||||||
|
*/
|
||||||
|
void addProfile( Profile profile );
|
||||||
|
|
||||||
|
void setProfiles( List<Profile> profiles );
|
||||||
|
|
||||||
|
List<Profile> getProfiles();
|
||||||
|
}
|
|
@ -37,10 +37,10 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.model.Dependency;
|
import org.apache.maven.model.Dependency;
|
||||||
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
import org.apache.maven.project.DefaultProjectBuildingRequest;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.ProjectBuilder;
|
import org.apache.maven.project.ProjectBuilder;
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -107,7 +107,7 @@ public class MavenMetadataSource
|
||||||
pomArtifact.setFile( artifact.getFile() );
|
pomArtifact.setFile( artifact.getFile() );
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration();
|
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
|
||||||
configuration.setLocalRepository( localRepository );
|
configuration.setLocalRepository( localRepository );
|
||||||
configuration.setRemoteRepositories( remoteRepositories );
|
configuration.setRemoteRepositories( remoteRepositories );
|
||||||
configuration.setLenientValidation( true );
|
configuration.setLenientValidation( true );
|
||||||
|
|
|
@ -18,9 +18,9 @@ import org.apache.maven.model.Exclusion;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.plugin.PluginManager;
|
import org.apache.maven.plugin.PluginManager;
|
||||||
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
import org.apache.maven.project.DefaultProjectBuildingRequest;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.codehaus.plexus.ContainerConfiguration;
|
import org.codehaus.plexus.ContainerConfiguration;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
@ -103,7 +103,7 @@ public abstract class AbstractCoreMavenComponentTestCase
|
||||||
{
|
{
|
||||||
MavenExecutionRequest request = createMavenExecutionRequest( pom );
|
MavenExecutionRequest request = createMavenExecutionRequest( pom );
|
||||||
|
|
||||||
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()
|
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest()
|
||||||
.setLocalRepository( request.getLocalRepository() )
|
.setLocalRepository( request.getLocalRepository() )
|
||||||
.setRemoteRepositories( request.getRemoteRepositories() );
|
.setRemoteRepositories( request.getRemoteRepositories() );
|
||||||
|
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ public class PomConstructionTest
|
||||||
pomFile = new File( pomFile, "pom.xml" );
|
pomFile = new File( pomFile, "pom.xml" );
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
|
ProjectBuildingRequest config = new DefaultProjectBuildingRequest();
|
||||||
|
|
||||||
String localRepoUrl = System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
|
String localRepoUrl = System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
|
||||||
localRepoUrl = "file://" + localRepoUrl;
|
localRepoUrl = "file://" + localRepoUrl;
|
||||||
|
|
|
@ -8,9 +8,9 @@ import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
|
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.project.DefaultProjectBuilder;
|
import org.apache.maven.project.DefaultProjectBuilder;
|
||||||
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
import org.apache.maven.project.DefaultProjectBuildingRequest;
|
||||||
import org.apache.maven.project.ProjectBuilder;
|
import org.apache.maven.project.ProjectBuilder;
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
import org.apache.maven.project.harness.PomTestWrapper;
|
import org.apache.maven.project.harness.PomTestWrapper;
|
||||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
@ -73,7 +73,7 @@ public class PomConstructionWithSettingsTest
|
||||||
File settingsFile = new File( testDirectory + File.separator + pomPath, "settings.xml" );
|
File settingsFile = new File( testDirectory + File.separator + pomPath, "settings.xml" );
|
||||||
Settings settings = readSettingsFile(settingsFile);
|
Settings settings = readSettingsFile(settingsFile);
|
||||||
|
|
||||||
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
|
ProjectBuildingRequest config = new DefaultProjectBuildingRequest();
|
||||||
|
|
||||||
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
|
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,14 +34,13 @@ import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
import org.apache.maven.execution.DefaultMavenExecutionResult;
|
import org.apache.maven.execution.DefaultMavenExecutionResult;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionResult;
|
import org.apache.maven.execution.MavenExecutionResult;
|
||||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.io.ModelReader;
|
import org.apache.maven.model.io.ModelReader;
|
||||||
import org.apache.maven.model.io.ModelWriter;
|
import org.apache.maven.model.io.ModelWriter;
|
||||||
import org.apache.maven.plugin.PluginManager;
|
import org.apache.maven.plugin.PluginManager;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.MavenProjectBuilder;
|
|
||||||
import org.apache.maven.project.MavenProjectBuildingResult;
|
import org.apache.maven.project.MavenProjectBuildingResult;
|
||||||
|
import org.apache.maven.project.ProjectBuilder;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
|
@ -97,9 +96,7 @@ public class MavenEmbedder
|
||||||
|
|
||||||
private Maven maven;
|
private Maven maven;
|
||||||
|
|
||||||
private PluginManager pluginManager;
|
private ProjectBuilder projectBuilder;
|
||||||
|
|
||||||
private MavenProjectBuilder mavenProjectBuilder;
|
|
||||||
|
|
||||||
private ModelReader modelReader;
|
private ModelReader modelReader;
|
||||||
|
|
||||||
|
@ -124,8 +121,6 @@ public class MavenEmbedder
|
||||||
private Configuration configuration;
|
private Configuration configuration;
|
||||||
|
|
||||||
private MavenExecutionRequest request;
|
private MavenExecutionRequest request;
|
||||||
|
|
||||||
private LifecycleExecutor lifecycleExecutor;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Constructors
|
// Constructors
|
||||||
|
@ -283,7 +278,7 @@ public class MavenEmbedder
|
||||||
{
|
{
|
||||||
getLogger().debug( "Building MavenProject instance: " + mavenProject );
|
getLogger().debug( "Building MavenProject instance: " + mavenProject );
|
||||||
|
|
||||||
return mavenProjectBuilder.build( mavenProject, request.getProjectBuildingConfiguration() );
|
return projectBuilder.build( mavenProject, request.getProjectBuilderRequest() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,7 +308,7 @@ public class MavenEmbedder
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MavenProjectBuildingResult projectBuildingResult = mavenProjectBuilder.buildProjectWithDependencies( request.getPom(), request.getProjectBuildingConfiguration() );
|
MavenProjectBuildingResult projectBuildingResult = projectBuilder.buildProjectWithDependencies( request.getPom(), request.getProjectBuilderRequest() );
|
||||||
|
|
||||||
result.setProject( projectBuildingResult.getProject() );
|
result.setProject( projectBuildingResult.getProject() );
|
||||||
|
|
||||||
|
@ -398,14 +393,12 @@ public class MavenEmbedder
|
||||||
|
|
||||||
maven = container.lookup( Maven.class );
|
maven = container.lookup( Maven.class );
|
||||||
|
|
||||||
mavenProjectBuilder = container.lookup( MavenProjectBuilder.class );
|
projectBuilder = container.lookup( ProjectBuilder.class );
|
||||||
|
|
||||||
populator = container.lookup( MavenExecutionRequestPopulator.class );
|
populator = container.lookup( MavenExecutionRequestPopulator.class );
|
||||||
|
|
||||||
container.lookup( RepositorySystem.class );
|
container.lookup( RepositorySystem.class );
|
||||||
|
|
||||||
lifecycleExecutor = container.lookup( LifecycleExecutor.class );
|
|
||||||
|
|
||||||
// This is temporary as we can probably cache a single request and use it for default values and
|
// This is temporary as we can probably cache a single request and use it for default values and
|
||||||
// simply cascade values in from requests used for individual executions.
|
// simply cascade values in from requests used for individual executions.
|
||||||
request = new DefaultMavenExecutionRequest();
|
request = new DefaultMavenExecutionRequest();
|
||||||
|
|
Loading…
Reference in New Issue