maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r583248 - in /maven/components/trunk/maven-project/src/main/java/org/apache/maven: profiles/build/DefaultProfileAdvisor.java profiles/build/ProfileAdvisor.java project/build/model/DefaultModelLineageBuilder.java
Date Tue, 09 Oct 2007 18:10:06 GMT
Author: jdcasey
Date: Tue Oct  9 11:10:05 2007
New Revision: 583248

URL: http://svn.apache.org/viewvc?rev=583248&view=rev
Log:
Fixed usage of repositories from active profiles in settings.xml for model-lineage building,
which is fundamental to the build.

Modified:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java?rev=583248&r1=583247&r2=583248&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
Tue Oct  9 11:10:05 2007
@@ -140,11 +140,15 @@
         return profileManager;
     }
 
-    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File projectDir,
-                                                                    List explicitlyActiveIds,
List explicitlyInactiveIds )
+    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( ProfileManager profileManager,
+                                                                    String modelId )
         throws ProjectBuildingException
     {
-        ProfileManager profileManager = buildProfileManager( model, projectDir, explicitlyActiveIds,
explicitlyInactiveIds );
+
+        if ( profileManager == null )
+        {
+            return new LinkedHashSet();
+        }
 
         List activeExternalProfiles;
         {
@@ -154,7 +158,7 @@
             }
             catch ( ProfileActivationException e )
             {
-                throw new ProjectBuildingException( model.getId(),
+                throw new ProjectBuildingException( modelId,
                                                     "Failed to compute active profiles for
repository aggregation.", e );
             }
 
@@ -175,7 +179,7 @@
                     }
                     catch ( InvalidRepositoryException e )
                     {
-                        throw new ProjectBuildingException( model.getId(), e.getMessage(),
e );
+                        throw new ProjectBuildingException( modelId, e.getMessage(), e );
                     }
 
                     remoteRepositories.add( artifactRepo );
@@ -186,6 +190,15 @@
         }
     }
 
+    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File projectDir,
+                                                                    List explicitlyActiveIds,
List explicitlyInactiveIds )
+        throws ProjectBuildingException
+    {
+        ProfileManager profileManager = buildProfileManager( model, projectDir, explicitlyActiveIds,
explicitlyInactiveIds );
+
+        return getArtifactRepositoriesFromActiveProfiles( profileManager, model.getId() );
+    }
+
     private void loadExternalProjectProfiles( ProfileManager profileManager, Model model,
File projectDir )
         throws ProjectBuildingException
     {
@@ -199,7 +212,7 @@
                 {
                     List active = root.getActiveProfiles();
 
-                    if ( active != null && !active.isEmpty() )
+                    if ( ( active != null ) && !active.isEmpty() )
                     {
                         profileManager.explicitlyActivate( root.getActiveProfiles() );
                     }
@@ -231,7 +244,7 @@
     public void contextualize( Context context )
         throws ContextException
     {
-        this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
 
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java?rev=583248&r1=583247&r2=583248&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
Tue Oct  9 11:10:05 2007
@@ -28,18 +28,21 @@
 import java.util.List;
 
 /**
- * 
+ *
  * @author jdcasey
  *
  */
 public interface ProfileAdvisor
 {
-    
+
     String ROLE = ProfileAdvisor.class.getName();
-    
+
+    LinkedHashSet getArtifactRepositoriesFromActiveProfiles( ProfileManager profileManager,
String modelId )
+        throws ProjectBuildingException;
+
     LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File projectDir,
List explicitlyActiveIds, List explicitlyInactiveIds )
         throws ProjectBuildingException;
-    
+
     List applyActivatedProfiles( Model model, File projectDir, List explicitlyActiveIds,
List explicitlyInactiveIds )
         throws ProjectBuildingException;
 

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java?rev=583248&r1=583247&r2=583248&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java
Tue Oct  9 11:10:05 2007
@@ -231,8 +231,6 @@
 
         File projectDir = pomFile == null ? null : pomFile.getParentFile();
 
-        loadActiveProfileRepositories( repositories, model, externalProfileManager, projectDir
);
-
         Set artifactRepositories = null;
 
         if ( repositories != null )
@@ -242,6 +240,8 @@
                 List lastRemoteRepos = oldArtifactRepositories;
                 List remoteRepos = mavenTools.buildArtifactRepositories( repositories );
 
+                loadActiveProfileRepositories( remoteRepos, model, externalProfileManager,
projectDir );
+
                 artifactRepositories = new LinkedHashSet( remoteRepos.size() + oldArtifactRepositories.size()
);
 
                 artifactRepositories.addAll( remoteRepos );
@@ -275,9 +275,15 @@
             explicitlyInactive = Collections.EMPTY_LIST;
         }
 
-        LinkedHashSet profileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles(
model, projectDir,
+        LinkedHashSet profileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles(
profileManager, model.getId() );
+
+        getLogger().debug( "Got the following repos from global profile manager:\n\n" + profileRepos
);
+
+        profileRepos.addAll( profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model,
projectDir,
                                                                                         
      explicitlyActive,
-                                                                                        
      explicitlyInactive );
+                                                                                        
      explicitlyInactive ) );
+
+        getLogger().debug( "Got the following repos from all profile managers:\n\n" + profileRepos
);
 
         if ( !profileRepos.isEmpty() )
         {



Mime
View raw message