maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r883430 - in /maven/maven-3/trunk: maven-compat/src/main/java/org/apache/maven/project/ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/project/
Date Mon, 23 Nov 2009 17:40:04 GMT
Author: bentmann
Date: Mon Nov 23 17:40:04 2009
New Revision: 883430

URL: http://svn.apache.org/viewvc?rev=883430&view=rev
Log:
[MNG-3902] Remove visibility MavenProjectBuilder#buildStandaloneSuperProject

Modified:
    maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java

Modified: maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=883430&r1=883429&r2=883430&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Mon Nov 23 17:40:04 2009
@@ -27,6 +27,8 @@
 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 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 )

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=883430&r1=883429&r2=883430&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Mon Nov
23 17:40:04 2009
@@ -41,6 +41,8 @@
 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 @@
 
     @Requirement
     MavenExecutionRequestPopulator populator;
-    
+
     private void fireEvent( MavenSession session, ExecutionEventCatapult catapult )
     {
         ExecutionListener listener = session.getRequest().getExecutionListener();
@@ -336,7 +338,10 @@
         //
         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;

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java?rev=883430&r1=883429&r2=883430&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Mon Nov 23 17:40:04 2009
@@ -40,7 +40,6 @@
 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 @@
         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 @@
         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
     {

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java?rev=883430&r1=883429&r2=883430&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java
Mon Nov 23 17:40:04 2009
@@ -19,23 +19,59 @@
 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;
 
     /**



Mime
View raw message