mirror of https://github.com/apache/maven.git
o Delayed injection of plugin default configuration until the project is actually executed to allow for plugin resolution from the reactor
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@803243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
87704b69b8
commit
13709defd0
|
@ -42,6 +42,7 @@ import org.apache.maven.model.building.ModelProblem;
|
|||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.ProjectBuilder;
|
||||
import org.apache.maven.project.ProjectBuildingException;
|
||||
import org.apache.maven.project.ProjectBuildingRequest;
|
||||
import org.apache.maven.project.ProjectBuildingResult;
|
||||
import org.apache.maven.repository.DelegatingLocalArtifactRepository;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
|
@ -215,8 +216,11 @@ public class DefaultMaven
|
|||
ExceptionHandler handler = new DefaultExceptionHandler();
|
||||
|
||||
ExceptionSummary es = handler.handleException( e );
|
||||
|
||||
result.addException( e );
|
||||
|
||||
if ( !result.getExceptions().contains( e ) )
|
||||
{
|
||||
result.addException( e );
|
||||
}
|
||||
|
||||
result.setExceptionSummary( es );
|
||||
|
||||
|
@ -288,8 +292,15 @@ public class DefaultMaven
|
|||
private void collectProjects( List<MavenProject> projects, List<File> files, MavenExecutionRequest request )
|
||||
throws MavenExecutionException, ProjectBuildingException
|
||||
{
|
||||
List<ProjectBuildingResult> results =
|
||||
projectBuilder.build( files, request.isRecursive(), request.getProjectBuildingRequest() );
|
||||
ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest();
|
||||
|
||||
/*
|
||||
* NOTE: We delay plugin configuration processing until a project is actually build to allow plugins to be
|
||||
* resolved from the reactor.
|
||||
*/
|
||||
projectBuildingRequest.setProcessPluginConfiguration( false );
|
||||
|
||||
List<ProjectBuildingResult> results = projectBuilder.build( files, request.isRecursive(), projectBuildingRequest );
|
||||
|
||||
for ( ProjectBuildingResult result : results )
|
||||
{
|
||||
|
|
|
@ -176,6 +176,9 @@ public class DefaultLifecycleExecutor
|
|||
{
|
||||
session.setCurrentProject( currentProject );
|
||||
|
||||
repositoryRequest.setRemoteRepositories( currentProject.getPluginArtifactRepositories() );
|
||||
populateDefaultConfigurationForPlugins( currentProject.getBuild().getPlugins(), repositoryRequest );
|
||||
|
||||
ClassRealm projectRealm = currentProject.getClassRealm();
|
||||
if ( projectRealm != null )
|
||||
{
|
||||
|
|
|
@ -499,7 +499,7 @@ public class DefaultProjectBuilder
|
|||
|
||||
try
|
||||
{
|
||||
if ( configuration.isProcessPlugins() )
|
||||
if ( configuration.isProcessPlugins() && configuration.isProcessPluginConfiguration() )
|
||||
{
|
||||
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
|
||||
repositoryRequest.setLocalRepository( configuration.getLocalRepository() );
|
||||
|
|
|
@ -52,6 +52,8 @@ public class DefaultProjectBuildingRequest
|
|||
|
||||
private boolean processPlugins;
|
||||
|
||||
private boolean processPluginConfiguration;
|
||||
|
||||
private List<Profile> profiles;
|
||||
|
||||
private List<String> activeProfileIds;
|
||||
|
@ -67,6 +69,7 @@ public class DefaultProjectBuildingRequest
|
|||
public DefaultProjectBuildingRequest()
|
||||
{
|
||||
processPlugins = true;
|
||||
processPluginConfiguration = true;
|
||||
profiles = new ArrayList<Profile>();
|
||||
activeProfileIds = new ArrayList<String>();
|
||||
inactiveProfileIds = new ArrayList<String>();
|
||||
|
@ -221,6 +224,17 @@ public class DefaultProjectBuildingRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isProcessPluginConfiguration()
|
||||
{
|
||||
return processPluginConfiguration;
|
||||
}
|
||||
|
||||
public ProjectBuildingRequest setProcessPluginConfiguration( boolean processPluginConfiguration )
|
||||
{
|
||||
this.processPluginConfiguration = processPluginConfiguration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectBuildingRequest setValidationLevel( int validationLevel )
|
||||
{
|
||||
this.validationLevel = validationLevel;
|
||||
|
|
|
@ -92,11 +92,15 @@ public interface ProjectBuildingRequest
|
|||
void setTopLevelProjectForReactor(MavenProject mavenProject);
|
||||
|
||||
MavenProject getTopLevelProjectFromReactor();
|
||||
|
||||
|
||||
ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
|
||||
|
||||
|
||||
boolean isProcessPlugins();
|
||||
|
||||
ProjectBuildingRequest setProcessPluginConfiguration( boolean processPluginConfiguration );
|
||||
|
||||
boolean isProcessPluginConfiguration();
|
||||
|
||||
/**
|
||||
* Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue