maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r781119 - /maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Date Tue, 02 Jun 2009 18:47:33 GMT
Author: bentmann
Date: Tue Jun  2 18:47:33 2009
New Revision: 781119

URL: http://svn.apache.org/viewvc?rev=781119&view=rev
Log:
o Fixed handling of project directory

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java?rev=781119&r1=781118&r2=781119&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Tue Jun  2 18:47:33 2009
@@ -28,6 +28,7 @@
 import org.apache.maven.lifecycle.LifecycleExecutionException;
 import org.apache.maven.lifecycle.LifecycleExecutor;
 import org.apache.maven.model.Build;
+import org.apache.maven.model.FileModelSource;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.ModelBuilder;
 import org.apache.maven.model.ModelBuildingException;
@@ -78,10 +79,10 @@
     public MavenProject build( File pomFile, ProjectBuildingRequest configuration )
         throws ProjectBuildingException
     {
-        return build( pomFile, pomFile.getParentFile(), configuration );
+        return build( pomFile, true, configuration );
     }
 
-    private MavenProject build( File pomFile, File projectDirectory, ProjectBuildingRequest
configuration )
+    private MavenProject build( File pomFile, boolean localProject, ProjectBuildingRequest
configuration )
         throws ProjectBuildingException
     {
         String cacheKey = getCacheKey( pomFile, configuration );
@@ -100,7 +101,16 @@
         ModelBuildingResult result;
         try
         {
-            result = modelBuilder.build( pomFile, configuration.getModelBuildingRequest(),
resolver );
+            if ( localProject )
+            {
+                result = modelBuilder.build( pomFile, configuration.getModelBuildingRequest(),
resolver );
+            }
+            else
+            {
+                result =
+                    modelBuilder.build( new FileModelSource( pomFile ), configuration.getModelBuildingRequest(),
+                                        resolver );
+            }
         }
         catch ( ModelBuildingException e )
         {
@@ -171,7 +181,7 @@
             throw new ProjectBuildingException( artifact.getId(), "Error resolving project
artifact.", e );
         }
 
-        return build( artifact.getFile(), null, configuration );
+        return build( artifact.getFile(), false, configuration );
     }
 
     /**
@@ -238,7 +248,7 @@
         throws InvalidProjectModelException
     {
         MavenProject project;
-        String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId()
);
+
         try
         {
             project = new MavenProject( model, repositorySystem, this, config );
@@ -247,10 +257,10 @@
             project.setArtifact( projectArtifact );
 
             project.setParentFile( parentFile );
-
         }
         catch ( InvalidRepositoryException e )
         {
+            String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId()
);
             throw new InvalidProjectModelException( projectId, e.getMessage(), projectDescriptor,
e );
         }
 



Mime
View raw message