mirror of https://github.com/apache/maven.git
[MNG-3902] Remove visibility MavenProjectBuilder#buildStandaloneSuperProject
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@883430 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9adfaf82b5
commit
5b75081750
|
@ -27,6 +27,8 @@ import org.apache.maven.execution.MavenSession;
|
|||
import org.apache.maven.model.Repository;
|
||||
import org.apache.maven.model.building.ModelBuildingException;
|
||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
import org.apache.maven.model.building.ModelSource;
|
||||
import org.apache.maven.model.building.UrlModelSource;
|
||||
import org.apache.maven.plugin.LegacySupport;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
|
@ -178,7 +180,10 @@ public class DefaultMavenProjectBuilder
|
|||
public MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration config )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
return projectBuilder.buildStandaloneSuperProject( config ).getProject();
|
||||
ModelSource modelSource = new UrlModelSource( getClass().getResource( "standalone.xml" ) );
|
||||
MavenProject project = projectBuilder.build( modelSource, config ).getProject();
|
||||
project.setExecutionRoot( true );
|
||||
return project;
|
||||
}
|
||||
|
||||
public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository )
|
||||
|
|
|
@ -41,6 +41,8 @@ import org.apache.maven.execution.MavenSession;
|
|||
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
||||
import org.apache.maven.model.building.ModelProblem;
|
||||
import org.apache.maven.model.building.ModelSource;
|
||||
import org.apache.maven.model.building.UrlModelSource;
|
||||
import org.apache.maven.project.DuplicateProjectException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.ProjectBuilder;
|
||||
|
@ -80,7 +82,7 @@ public class DefaultMaven
|
|||
|
||||
@Requirement
|
||||
MavenExecutionRequestPopulator populator;
|
||||
|
||||
|
||||
private void fireEvent( MavenSession session, ExecutionEventCatapult catapult )
|
||||
{
|
||||
ExecutionListener listener = session.getRequest().getExecutionListener();
|
||||
|
@ -336,7 +338,10 @@ public class DefaultMaven
|
|||
//
|
||||
if ( request.getPom() == null || !request.getPom().exists() )
|
||||
{
|
||||
MavenProject project = projectBuilder.buildStandaloneSuperProject( request.getProjectBuildingRequest() ).getProject();
|
||||
ModelSource modelSource = new UrlModelSource( getClass().getResource( "project/standalone.xml" ) );
|
||||
MavenProject project =
|
||||
projectBuilder.build( modelSource, request.getProjectBuildingRequest() ).getProject();
|
||||
project.setExecutionRoot( true );
|
||||
projects.add( project );
|
||||
request.setProjectPresent( false );
|
||||
return projects;
|
||||
|
|
|
@ -40,7 +40,6 @@ import org.apache.maven.model.building.ModelProblem;
|
|||
import org.apache.maven.model.building.ModelProcessor;
|
||||
import org.apache.maven.model.building.ModelSource;
|
||||
import org.apache.maven.model.building.StringModelSource;
|
||||
import org.apache.maven.model.building.UrlModelSource;
|
||||
import org.apache.maven.model.resolution.ModelResolver;
|
||||
import org.apache.maven.project.artifact.ProjectArtifact;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
|
@ -82,6 +81,12 @@ public class DefaultProjectBuilder
|
|||
return build( pomFile, new FileModelSource( pomFile ), configuration );
|
||||
}
|
||||
|
||||
public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest configuration )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
return build( null, modelSource, configuration );
|
||||
}
|
||||
|
||||
private ProjectBuildingResult build( File pomFile, ModelSource modelSource, ProjectBuildingRequest configuration )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
|
@ -248,21 +253,6 @@ public class DefaultProjectBuilder
|
|||
return new StringModelSource( buffer, artifact.getId() );
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used for pom-less execution like running archetype:generate.
|
||||
*
|
||||
* I am taking out the profile handling and the interpolation of the base directory until we
|
||||
* spec this out properly.
|
||||
*/
|
||||
public ProjectBuildingResult buildStandaloneSuperProject( ProjectBuildingRequest config )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
ProjectBuildingResult result =
|
||||
build( null, new UrlModelSource( getClass().getResource( "standalone.xml" ) ), config );
|
||||
result.getProject().setExecutionRoot( true );
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest config )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
|
|
|
@ -19,23 +19,59 @@ import java.io.File;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.model.building.ModelSource;
|
||||
|
||||
/**
|
||||
* Builds in-memory descriptions of projects.
|
||||
*/
|
||||
public interface ProjectBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* Builds a project descriptor from the specified POM file.
|
||||
*
|
||||
* @param projectFile The POM file to build the project from, must not be {@code null}.
|
||||
* @param request The project building request that holds further parameters, must not be {@code null}.
|
||||
* @return The result of the project building, never {@code null}.
|
||||
* @throws ProjectBuildingException If the project descriptor could not be successfully built.
|
||||
*/
|
||||
ProjectBuildingResult build( File projectFile, ProjectBuildingRequest request )
|
||||
throws ProjectBuildingException;
|
||||
|
||||
/**
|
||||
* Builds a project descriptor for the specified artifact.
|
||||
*
|
||||
* @param projectArtifact The POM artifact to build the project from, must not be {@code null}.
|
||||
* @param request The project building request that holds further parameters, must not be {@code null}.
|
||||
* @return The result of the project building, never {@code null}.
|
||||
* @throws ProjectBuildingException If the project descriptor could not be successfully built.
|
||||
*/
|
||||
ProjectBuildingResult build( Artifact projectArtifact, ProjectBuildingRequest request )
|
||||
throws ProjectBuildingException;
|
||||
|
||||
/**
|
||||
* Builds a project descriptor for the specified artifact.
|
||||
*
|
||||
* @param projectArtifact The POM artifact to build the project from, must not be {@code null}.
|
||||
* @param allowStubModel A flag controlling the case of a missing POM artifact. If {@code true} and the specified
|
||||
* POM artifact does not exist, a simple stub model will be returned. If {@code false}, an exception will
|
||||
* be thrown.
|
||||
* @param request The project building request that holds further parameters, must not be {@code null}.
|
||||
* @return The result of the project building, never {@code null}.
|
||||
* @throws ProjectBuildingException If the project descriptor could not be successfully built.
|
||||
*/
|
||||
ProjectBuildingResult build( Artifact projectArtifact, boolean allowStubModel, ProjectBuildingRequest request )
|
||||
throws ProjectBuildingException;
|
||||
|
||||
// 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
|
||||
// would ever need this so it should not be exposed in a public API
|
||||
ProjectBuildingResult buildStandaloneSuperProject( ProjectBuildingRequest request )
|
||||
/**
|
||||
* Builds a project descriptor for the specified model source.
|
||||
*
|
||||
* @param modelSource The source of the model to built the project descriptor from, must not be {@code null}.
|
||||
* @param request The project building request that holds further parameters, must not be {@code null}.
|
||||
* @return The result of the project building, never {@code null}.
|
||||
* @throws ProjectBuildingException If the project descriptor could not be successfully built.
|
||||
*/
|
||||
ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request )
|
||||
throws ProjectBuildingException;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue