You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2007/11/15 06:38:03 UTC

svn commit: r595215 [3/4] - in /maven/components/trunk: ./ maven-build-context/ maven-core/ maven-core/src/main/aspect/org/apache/maven/compat/plugin/ maven-core/src/main/aspect/org/apache/maven/errors/ maven-core/src/main/java/org/apache/maven/ maven-...

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=595215&r1=595214&r2=595215&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 Wed Nov 14 21:37:55 2007
@@ -26,11 +26,12 @@
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Profile;
 import org.apache.maven.model.Repository;
+import org.apache.maven.profiles.DefaultProfileManager;
 import org.apache.maven.profiles.MavenProfilesBuilder;
+import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.profiles.ProfilesConversionUtils;
 import org.apache.maven.profiles.ProfilesRoot;
-import org.apache.maven.profiles.ProfileManager;
-import org.apache.maven.profiles.DefaultProfileManager;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
 import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.apache.maven.profiles.injection.ProfileInjector;
 import org.apache.maven.project.ProjectBuildingException;
@@ -66,23 +67,40 @@
 
     private Logger logger;
 
-    public List applyActivatedProfiles( Model model, File pomFile, List explicitlyActiveIds, List explicitlyInactiveIds, boolean useProfilesXml )
+    public List applyActivatedProfiles( Model model,
+                                        File pomFile,
+                                        List explicitlyActiveIds,
+                                        List explicitlyInactiveIds,
+                                        boolean useProfilesXml,
+                                        ProfileActivationContext activationContext )
         throws ProjectBuildingException
     {
-        logger.debug( "Building profile manager for model: " + model.getId() + " with pom file: " + pomFile );
-        ProfileManager profileManager = buildProfileManager( model, pomFile, explicitlyActiveIds, explicitlyInactiveIds, useProfilesXml );
+        logger.debug( "Building profile manager for model: " + model.getId() + " with pom file: "
+                      + pomFile );
+        ProfileManager profileManager = buildProfileManager( model,
+                                                             pomFile,
+                                                             explicitlyActiveIds,
+                                                             explicitlyInactiveIds,
+                                                             useProfilesXml,
+                                                             activationContext );
 
         return applyActivatedProfiles( model, pomFile, profileManager );
     }
 
-    public List applyActivatedExternalProfiles( Model model, File projectDir, ProfileManager externalProfileManager )
+    public List applyActivatedExternalProfiles( Model model,
+                                                File projectDir,
+                                                ProfileManager externalProfileManager )
         throws ProjectBuildingException
     {
-        logger.debug( "Building profile manager for model: " + model.getId() + " with external profile manager including profiles: " + externalProfileManager.getProfilesById() );
+        logger.debug( "Building profile manager for model: " + model.getId()
+                      + " with external profile manager including profiles: "
+                      + externalProfileManager.getProfilesById() );
         return applyActivatedProfiles( model, projectDir, externalProfileManager );
     }
 
-    private List applyActivatedProfiles( Model model, File pomFile, ProfileManager profileManager )
+    private List applyActivatedProfiles( Model model,
+                                         File pomFile,
+                                         ProfileManager profileManager )
         throws ProjectBuildingException
     {
         List activeProfiles;
@@ -127,10 +145,15 @@
         return activeProfiles;
     }
 
-    private ProfileManager buildProfileManager( Model model, File pomFile, List explicitlyActiveIds, List explicitlyInactiveIds, boolean useProfilesXml )
+    private ProfileManager buildProfileManager( Model model,
+                                                File pomFile,
+                                                List explicitlyActiveIds,
+                                                List explicitlyInactiveIds,
+                                                boolean useProfilesXml,
+                                                ProfileActivationContext profileActivationContext )
         throws ProjectBuildingException
     {
-        ProfileManager profileManager = new DefaultProfileManager( container );
+        ProfileManager profileManager = new DefaultProfileManager( container, profileActivationContext );
 
         profileManager.explicitlyActivate( explicitlyActiveIds );
 
@@ -165,8 +188,10 @@
             }
             catch ( ProfileActivationException e )
             {
-                throw new ProjectBuildingException( modelId,
-                                                    "Failed to compute active profiles for repository aggregation.", pomFile, e );
+                throw new ProjectBuildingException(
+                                                    modelId,
+                                                    "Failed to compute active profiles for repository aggregation.",
+                                                    pomFile, e );
             }
 
             LinkedHashSet remoteRepositories = new LinkedHashSet();
@@ -197,17 +222,27 @@
         }
     }
 
-    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File pomFile,
-                                                                    List explicitlyActiveIds, List explicitlyInactiveIds,
-                                                                    boolean useProfilesXml )
+    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
+                                                                    File pomFile,
+                                                                    List explicitlyActiveIds,
+                                                                    List explicitlyInactiveIds,
+                                                                    boolean useProfilesXml,
+                                                                    ProfileActivationContext activationContext )
         throws ProjectBuildingException
     {
-        ProfileManager profileManager = buildProfileManager( model, pomFile, explicitlyActiveIds, explicitlyInactiveIds, useProfilesXml );
+        ProfileManager profileManager = buildProfileManager( model,
+                                                             pomFile,
+                                                             explicitlyActiveIds,
+                                                             explicitlyInactiveIds,
+                                                             useProfilesXml,
+                                                             activationContext );
 
         return getArtifactRepositoriesFromActiveProfiles( profileManager, pomFile, model.getId() );
     }
 
-    private void loadExternalProjectProfiles( ProfileManager profileManager, Model model, File pomFile )
+    private void loadExternalProjectProfiles( ProfileManager profileManager,
+                                              Model model,
+                                              File pomFile )
         throws ProjectBuildingException
     {
         if ( pomFile != null )
@@ -238,14 +273,15 @@
             }
             catch ( IOException e )
             {
-                throw new ProjectBuildingException( model.getId(), "Cannot read profiles.xml resource from directory: "
-                    + projectDir, pomFile, e );
+                throw new ProjectBuildingException( model.getId(),
+                                                    "Cannot read profiles.xml resource from directory: "
+                                                                    + projectDir, pomFile, e );
             }
             catch ( XmlPullParserException e )
             {
                 throw new ProjectBuildingException( model.getId(),
-                                                    "Cannot parse profiles.xml resource from directory: " + projectDir,
-                                                    pomFile, e );
+                                                    "Cannot parse profiles.xml resource from directory: "
+                                                                    + projectDir, pomFile, e );
             }
         }
     }

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=595215&r1=595214&r2=595215&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 Wed Nov 14 21:37:55 2007
@@ -21,6 +21,7 @@
 
 import org.apache.maven.model.Model;
 import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
 import org.apache.maven.project.ProjectBuildingException;
 
 import java.io.File;
@@ -46,14 +47,16 @@
                                                              File pomFile,
                                                              List explicitlyActiveIds,
                                                              List explicitlyInactiveIds,
-                                                             boolean useProfilesXml )
+                                                             boolean useProfilesXml,
+                                                             ProfileActivationContext profileActivationContext )
         throws ProjectBuildingException;
 
     List applyActivatedProfiles( Model model,
                                  File pomFile,
                                  List explicitlyActiveIds,
                                  List explicitlyInactiveIds,
-                                 boolean useProfilesXml )
+                                 boolean useProfilesXml,
+                                 ProfileActivationContext activationContext )
         throws ProjectBuildingException;
 
     List applyActivatedExternalProfiles( Model model,

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Wed Nov 14 21:37:55 2007
@@ -37,7 +37,6 @@
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.ManagedVersionMap;
 import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DependencyManagement;
@@ -50,11 +49,11 @@
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.profiles.MavenProfilesBuilder;
 import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
 import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.apache.maven.profiles.build.ProfileAdvisor;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.apache.maven.project.build.ProjectBuildCache;
-import org.apache.maven.project.build.ProjectBuildContext;
 import org.apache.maven.project.build.model.DefaultModelLineage;
 import org.apache.maven.project.build.model.ModelLineage;
 import org.apache.maven.project.build.model.ModelLineageBuilder;
@@ -66,7 +65,8 @@
 import org.apache.maven.project.path.PathTranslator;
 import org.apache.maven.project.validation.ModelValidationResult;
 import org.apache.maven.project.validation.ModelValidator;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
@@ -129,9 +129,8 @@
  * @version $Id$
  */
 public class DefaultMavenProjectBuilder
-    extends AbstractLogEnabled
     implements MavenProjectBuilder,
-    Initializable
+    Initializable, LogEnabled
 {
     protected MavenProfilesBuilder profilesBuilder;
 
@@ -158,8 +157,6 @@
 
     private ProfileAdvisor profileAdvisor;
 
-    private BuildContextManager buildContextManager;
-
     private MavenTools mavenTools;
 
     public static final String MAVEN_MODEL_VERSION = "4.0.0";
@@ -182,6 +179,7 @@
     }
 
     /** @deprecated  */
+    @Deprecated
     public MavenProject buildFromRepository( Artifact artifact,
                                              List remoteArtifactRepositories,
                                              ArtifactRepository localRepository,
@@ -198,23 +196,16 @@
                                              ArtifactRepository localRepository )
         throws ProjectBuildingException
     {
-        ProjectBuildCache projectBuildCache = ProjectBuildCache.read( buildContextManager );
-
-        MavenProject project = projectBuildCache.getCachedProject( artifact );
-
-        if ( project != null )
-        {
-            return project;
-        }
-
         Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
 
-        return buildInternal( artifact.getFile(), model, localRepository, remoteArtifactRepositories, null, null,
-                              false, false );
+        return buildInternal( model, localRepository, remoteArtifactRepositories, artifact.getFile(), null,
+                              false, false, false );
     }
 
     private MavenProject superProject;
 
+    private Logger logger;
+
     public MavenProject buildStandaloneSuperProject()
         throws ProjectBuildingException
     {
@@ -391,23 +382,15 @@
                                                       ProfileManager profileManager )
         throws ProjectBuildingException
     {
-        /*
-        // TODO: Remove this once we have build-context stuff working...
-        if ( !container.getContext().contains( "SystemProperties" ) )
-        {
-            container.addContextValue( "SystemProperties", System.getProperties() );
-        }
-        */
-
         Model model = readModel( "unknown", projectDescriptor, STRICT_MODEL_PARSING );
 
-        MavenProject project = buildInternal( projectDescriptor,
-            model,
+        MavenProject project = buildInternal( model,
             localRepository,
             buildArtifactRepositories( getSuperModel() ),
             projectDescriptor,
             profileManager,
             STRICT_MODEL_PARSING,
+            true,
             true );
 
         return project;
@@ -530,13 +513,13 @@
     // jvz:note
     // We've got a mixture of things going in the USD and from the repository, sometimes the descriptor
     // is a real file and sometimes null which makes things confusing.
-    private MavenProject buildInternal( File pomLocation,
-                                        Model model,
+    private MavenProject buildInternal( Model model,
                                         ArtifactRepository localRepository,
                                         List parentSearchRepositories,
                                         File projectDescriptor,
                                         ProfileManager externalProfileManager,
-                                        boolean strict, boolean validProfilesXmlLocation )
+                                        boolean strict, boolean validProfilesXmlLocation,
+                                        boolean fromSourceTree )
         throws ProjectBuildingException
     {
         Model superModel = getSuperModel();
@@ -549,6 +532,9 @@
 
         List explicitlyInactive;
 
+        // FIXME: Find a way to pass in this context, so it's never null!
+        ProfileActivationContext profileActivationContext;
+
         if ( externalProfileManager != null )
         {
             // used to trigger the caching of SystemProperties in the container context...
@@ -564,15 +550,19 @@
             explicitlyActive = externalProfileManager.getExplicitlyActivatedIds();
 
             explicitlyInactive = externalProfileManager.getExplicitlyDeactivatedIds();
+
+            profileActivationContext = externalProfileManager.getProfileActivationContext();
         }
         else
         {
             explicitlyActive = Collections.EMPTY_LIST;
 
             explicitlyInactive = Collections.EMPTY_LIST;
+
+            profileActivationContext = new DefaultProfileActivationContext( System.getProperties(), false );
         }
 
-        superProject.setActiveProfiles( profileAdvisor.applyActivatedProfiles( superModel, projectDescriptor, explicitlyActive, explicitlyInactive, validProfilesXmlLocation ) );
+        superProject.setActiveProfiles( profileAdvisor.applyActivatedProfiles( superModel, projectDescriptor, explicitlyActive, explicitlyInactive, validProfilesXmlLocation, profileActivationContext ) );
 
         //noinspection CollectionDeclaredAsConcreteClass
         LinkedList lineage = new LinkedList();
@@ -581,7 +571,8 @@
             parentSearchRepositories,
             projectDescriptor, explicitlyActive,
             explicitlyInactive,
-            validProfilesXmlLocation );
+            validProfilesXmlLocation,
+            profileActivationContext );
 
         Model originalModel = ModelUtils.cloneModel( model );
 
@@ -645,25 +636,20 @@
 
         try
         {
-            project = processProjectLogic( pomLocation, project, projectDescriptor, strict );
+            project = processProjectLogic( project, projectDescriptor, strict );
         }
         catch ( ModelInterpolationException e )
         {
-            throw new InvalidProjectModelException( projectId, e.getMessage(), pomLocation, e );
+            throw new InvalidProjectModelException( projectId, e.getMessage(), projectDescriptor, e );
         }
         catch ( InvalidRepositoryException e )
         {
-            throw new InvalidProjectModelException( projectId, e.getMessage(), pomLocation, e );
+            throw new InvalidProjectModelException( projectId, e.getMessage(), projectDescriptor, e );
         }
 
-        ProjectBuildCache projectBuildCache = ProjectBuildCache.read( buildContextManager );
-
-        projectBuildCache.cacheProject( project );
-
-        projectBuildCache.store( buildContextManager );
-
-        if ( projectDescriptor != null )
+        if ( fromSourceTree )
         {
+            getLogger().debug( "Aligning project: " + project.getId() + " to base directory: " + projectDescriptor.getParentFile() );
             pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor.getParentFile() );
 
             Build build = project.getBuild();
@@ -678,19 +664,6 @@
             project.setFile( projectDescriptor );
         }
 
-        MavenProject rawParent = project.getParent();
-
-        if ( rawParent != null )
-        {
-            MavenProject processedParent = projectBuildCache.getCachedProject( rawParent );
-
-            // yeah, this null check might be a bit paranoid, but better safe than sorry...
-            if ( processedParent != null )
-            {
-                project.setParent( processedParent );
-            }
-        }
-
         project.setManagedVersionMap( createManagedVersionMap( projectId, project.getDependencyManagement(), projectDescriptor ) );
 
         return project;
@@ -711,14 +684,15 @@
                                                       File pomFile,
                                                       List explicitlyActive,
                                                       List explicitlyInactive,
-                                                      boolean validProfilesXmlLocation )
+                                                      boolean validProfilesXmlLocation,
+                                                      ProfileActivationContext profileActivationContext )
         throws ProjectBuildingException
     {
         LinkedHashSet collected = new LinkedHashSet();
 
-        collectInitialRepositoriesFromModel( collected, model, pomFile, explicitlyActive, explicitlyInactive, validProfilesXmlLocation );
+        collectInitialRepositoriesFromModel( collected, model, pomFile, explicitlyActive, explicitlyInactive, validProfilesXmlLocation, profileActivationContext );
 
-        collectInitialRepositoriesFromModel( collected, superModel, null, explicitlyActive, explicitlyInactive, validProfilesXmlLocation );
+        collectInitialRepositoriesFromModel( collected, superModel, null, explicitlyActive, explicitlyInactive, validProfilesXmlLocation, profileActivationContext );
 
         if ( ( parentSearchRepositories != null ) && !parentSearchRepositories.isEmpty() )
         {
@@ -733,10 +707,11 @@
                                                       File pomFile,
                                                       List explicitlyActive,
                                                       List explicitlyInactive,
-                                                      boolean validProfilesXmlLocation )
+                                                      boolean validProfilesXmlLocation,
+                                                      ProfileActivationContext profileActivationContext )
         throws ProjectBuildingException
     {
-        Set reposFromProfiles = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model, pomFile, explicitlyActive, explicitlyInactive, validProfilesXmlLocation );
+        Set reposFromProfiles = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model, pomFile, explicitlyActive, explicitlyInactive, validProfilesXmlLocation, profileActivationContext );
 
         if ( ( reposFromProfiles != null ) && !reposFromProfiles.isEmpty() )
         {
@@ -802,8 +777,7 @@
      * the resolved source roots, etc for the parent - that occurs for the parent when it is constructed independently
      * and projects are not cached or reused
      */
-    private MavenProject processProjectLogic( File pomLocation,
-                                              MavenProject project,
+    private MavenProject processProjectLogic( MavenProject project,
                                               File pomFile,
                                               boolean strict )
         throws ProjectBuildingException, ModelInterpolationException, InvalidRepositoryException
@@ -887,7 +861,7 @@
 
         if ( validationResult.getMessageCount() > 0 )
         {
-            throw new InvalidProjectModelException( projectId, "Failed to validate POM", pomLocation,
+            throw new InvalidProjectModelException( projectId, "Failed to validate POM", pomFile,
                 validationResult );
         }
 
@@ -895,11 +869,11 @@
             mavenTools.buildArtifactRepositories( model.getRepositories() ) );
 
         // TODO: these aren't taking active project artifacts into consideration in the reactor
-        project.setPluginArtifacts( createPluginArtifacts( projectId, project.getBuildPlugins(), pomLocation ) );
+        project.setPluginArtifacts( createPluginArtifacts( projectId, project.getBuildPlugins(), pomFile ) );
 
-        project.setReportArtifacts( createReportArtifacts( projectId, project.getReportPlugins(), pomLocation ) );
+        project.setReportArtifacts( createReportArtifacts( projectId, project.getReportPlugins(), pomFile ) );
 
-        project.setExtensionArtifacts( createExtensionArtifacts( projectId, project.getBuildExtensions(), pomLocation ) );
+        project.setExtensionArtifacts( createExtensionArtifacts( projectId, project.getBuildExtensions(), pomFile ) );
 
         return project;
     }
@@ -925,26 +899,26 @@
 
         modelLineageBuilder.resumeBuildingModelLineage( modelLineage, localRepository, externalProfileManager, !strict );
 
-        ProjectBuildContext projectContext = ProjectBuildContext.getProjectBuildContext( buildContextManager, true );
-
-        projectContext.setModelLineage( modelLineage );
-
-        projectContext.store( buildContextManager );
-
         List explicitlyActive;
 
         List explicitlyInactive;
 
+        // FIXME: Find a way to pass in this context, so it's never null!
+        ProfileActivationContext profileActivationContext;
+
         if ( externalProfileManager != null )
         {
             explicitlyActive = externalProfileManager.getExplicitlyActivatedIds();
 
             explicitlyInactive = externalProfileManager.getExplicitlyDeactivatedIds();
+
+            profileActivationContext = externalProfileManager.getProfileActivationContext();
         }
         else
         {
             explicitlyActive = Collections.EMPTY_LIST;
             explicitlyInactive = Collections.EMPTY_LIST;
+            profileActivationContext = new DefaultProfileActivationContext( System.getProperties(), false );
         }
 
         MavenProject lastProject = null;
@@ -957,20 +931,20 @@
             MavenProject project = new MavenProject( currentModel );
             project.setFile( currentPom );
 
-            projectContext.setCurrentProject( project );
-            projectContext.store( buildContextManager );
-
-            project.setActiveProfiles( profileAdvisor.applyActivatedProfiles( currentModel, currentPom, explicitlyActive,
-                explicitlyInactive, validProfilesXmlLocation ) );
-
             if ( lastProject != null )
             {
                 lastProject.setParent( project );
+                project = lastProject.getParent();
 
                 lastProject.setParentArtifact( artifactFactory.createParentArtifact( project.getGroupId(), project
                     .getArtifactId(), project.getVersion() ) );
             }
 
+            // NOTE: the caching aspect may replace the parent project instance, so we apply profiles here.
+            // TODO: Review this...is that a good idea, to allow application of profiles when other profiles could have been applied already?
+            project.setActiveProfiles( profileAdvisor.applyActivatedProfiles( project.getModel(), project.getFile(), explicitlyActive,
+                                                                              explicitlyInactive, validProfilesXmlLocation, profileActivationContext ) );
+
             lineage.addFirst( project );
 
             lastProject = project;
@@ -1055,6 +1029,7 @@
      * @return
      * @throws ProjectBuildingException
      */
+    @Deprecated
     protected Set createPluginArtifacts( String projectId,
                                          List plugins, String pomLocation )
         throws ProjectBuildingException
@@ -1120,6 +1095,7 @@
      * @return
      * @throws ProjectBuildingException
      */
+    @Deprecated
     protected Set createReportArtifacts( String projectId,
                                          List reports, String pomLocation )
         throws ProjectBuildingException
@@ -1181,6 +1157,7 @@
      * @return
      * @throws ProjectBuildingException
      */
+    @Deprecated
     protected Set createExtensionArtifacts( String projectId,
                                             List extensions, String pomLocation )
         throws ProjectBuildingException
@@ -1271,5 +1248,15 @@
         {
             IOUtil.close( reader );
         }
+    }
+
+    protected Logger getLogger()
+    {
+        return logger;
+    }
+
+    public void enableLogging( Logger logger )
+    {
+        this.logger = logger;
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Wed Nov 14 21:37:55 2007
@@ -36,7 +36,6 @@
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.model.Exclusion;
@@ -45,7 +44,6 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.build.ProjectBuildCache;
 import org.apache.maven.project.validation.ModelValidationResult;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
@@ -81,8 +79,6 @@
 
     private RepositoryMetadataManager repositoryMetadataManager;
 
-    private BuildContextManager buildContextManager;
-
     // lazily instantiated and cached.
     private MavenProject superProject;
 
@@ -108,12 +104,10 @@
             throw new ArtifactMetadataRetrievalException( "Cannot lookup MavenProjectBuilder component instance: " + e.getMessage(), e );
         }
 
-        ProjectBuildCache cache = ProjectBuildCache.read( buildContextManager );
-
         MavenProject project = null;
 
         Artifact pomArtifact;
-        
+
         boolean done = false;
         do
         {
@@ -127,45 +121,40 @@
             }
             else
             {
-                project = cache.getCachedProject( artifact );
-
-                if ( project == null )
+                try
                 {
-                    try
-                    {
-                        project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository );
-                    }
-                    catch ( InvalidProjectModelException e )
-                    {
-                        getLogger().warn( "POM for \'" + pomArtifact +
-                            "\' is invalid. It will be ignored for artifact resolution. Reason: " + e.getMessage() );
+                    project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository );
+                }
+                catch ( InvalidProjectModelException e )
+                {
+                    getLogger().warn( "POM for \'" + pomArtifact +
+                        "\' is invalid. It will be ignored for artifact resolution. Reason: " + e.getMessage() );
 
-                        if ( getLogger().isDebugEnabled() )
-                        {
-                            getLogger().debug( "Reason: " + e.getMessage() );
+                    if ( getLogger().isDebugEnabled() )
+                    {
+                        getLogger().debug( "Reason: " + e.getMessage() );
 
-                            ModelValidationResult validationResult = e.getValidationResult();
+                        ModelValidationResult validationResult = e.getValidationResult();
 
-                            if ( validationResult != null )
+                        if ( validationResult != null )
+                        {
+                            getLogger().debug( "\nValidation Errors:" );
+                            for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
                             {
-                                getLogger().debug( "\nValidation Errors:" );
-                                for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
-                                {
-                                    getLogger().debug( i.next().toString() );
-                                }
-                                getLogger().debug( "\n" );
+                                getLogger().debug( i.next().toString() );
                             }
+                            getLogger().debug( "\n" );
                         }
-
-                        project = null;
                     }
-                    catch ( ProjectBuildingException e )
+
+                    project = null;
+                }
+                catch ( ProjectBuildingException e )
+                {
+                    if ( strictlyEnforceThePresenceOfAValidMavenPOM )
                     {
-                        if ( strictlyEnforceThePresenceOfAValidMavenPOM )
-                        {
-                            throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file for artifact '" +
-                                artifact.getDependencyConflictId() + "': " + e.getMessage(), e, artifact );
-                        }
+                        throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file for artifact '" +
+                            artifact.getDependencyConflictId() + "': " + e.getMessage(), e, artifact );
                     }
                 }
 

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/PomMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/PomMetadataSource.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/PomMetadataSource.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/PomMetadataSource.java Wed Nov 14 21:37:55 2007
@@ -23,18 +23,15 @@
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
 import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.resolver.metadata.MetadataResolution;
 import org.apache.maven.artifact.resolver.metadata.MetadataRetrievalException;
 import org.apache.maven.artifact.resolver.metadata.MetadataSource;
-import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.project.InvalidProjectModelException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.build.ProjectBuildCache;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -63,8 +60,6 @@
 
     private ArtifactFactory artifactFactory;
 
-    private BuildContextManager buildContextManager;
-
     // lazily instantiated and cached.
     private MavenProject superProject;
 
@@ -88,33 +83,26 @@
                 "Cannot lookup MavenProjectBuilder component instance: " + e.getMessage(), e );
         }
 
-        ProjectBuildCache cache = ProjectBuildCache.read( buildContextManager );
-
-        MavenProject project;
+        MavenProject project = null;
 
         Artifact pomArtifact = artifactFactory.createProjectArtifact( artifactMetadata.getGroupId(), artifactMetadata.getArtifactId(),
             artifactMetadata.getVersion(), artifactMetadata.getScope() );
 
-        project = cache.getCachedProject( artifactMetadata.getGroupId(), artifactMetadata.getArtifactId(), artifactMetadata.getVersion() );
-
-        if ( project == null )
+        try
         {
-            try
-            {
-                project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository );
-            }
-            catch ( InvalidProjectModelException e )
-            {
-                // We want to capture this in the graph so that we can display the error to the user
-            }
-            catch ( ProjectBuildingException e )
+            project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository );
+        }
+        catch ( InvalidProjectModelException e )
+        {
+            // We want to capture this in the graph so that we can display the error to the user
+        }
+        catch ( ProjectBuildingException e )
+        {
+            if ( strictlyEnforceThePresenceOfAValidMavenPOM )
             {
-                if ( strictlyEnforceThePresenceOfAValidMavenPOM )
-                {
-                    throw new MetadataRetrievalException(
-                        "Unable to read the metadata file for artifactMetadata '" +
-                            artifactMetadata.getDependencyConflictId() + "': " + e.getMessage(), e, artifactMetadata );
-                }
+                throw new MetadataRetrievalException(
+                    "Unable to read the metadata file for artifactMetadata '" +
+                        artifactMetadata.getDependencyConflictId() + "': " + e.getMessage(), e, artifactMetadata );
             }
         }
 

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=595215&r1=595214&r2=595215&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 Wed Nov 14 21:37:55 2007
@@ -27,14 +27,14 @@
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Parent;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.profiles.ProfileManager;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.build.ProjectBuildCache;
+import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
 import org.apache.maven.profiles.build.ProfileAdvisor;
+import org.apache.maven.project.ProjectBuildingException;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
@@ -69,68 +69,83 @@
 
     private ProfileAdvisor profileAdvisor;
 
-    private BuildContextManager buildContextManager;
-
     private Logger logger;
 
     public DefaultModelLineageBuilder()
     {
     }
 
-    public DefaultModelLineageBuilder( ArtifactResolver resolver, ArtifactFactory artifactFactory, BuildContextManager buildContextManager )
+    public DefaultModelLineageBuilder( ArtifactResolver resolver,
+                                       ArtifactFactory artifactFactory )
     {
         artifactResolver = resolver;
         this.artifactFactory = artifactFactory;
-        this.buildContextManager = buildContextManager;
     }
 
     /**
      * @see org.apache.maven.project.build.model.ModelLineageBuilder#buildModelLineage(java.io.File, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List)
      */
-    public ModelLineage buildModelLineage( File pom, ArtifactRepository localRepository, List remoteRepositories,
-                                           ProfileManager profileManager, boolean allowStubs, boolean validProfilesXmlLocation )
+    public ModelLineage buildModelLineage( File pom,
+                                           ArtifactRepository localRepository,
+                                           List remoteRepositories,
+                                           ProfileManager profileManager,
+                                           boolean allowStubs,
+                                           boolean validProfilesXmlLocation )
         throws ProjectBuildingException
     {
-        ProjectBuildCache projectBuildCache = ProjectBuildCache.read( buildContextManager );
-
         ModelLineage lineage = new DefaultModelLineage();
 
         List currentRemoteRepositories = remoteRepositories == null ? new ArrayList()
-                                                                   : new ArrayList( remoteRepositories );
+                        : new ArrayList( remoteRepositories );
 
-        ModelAndFile current = new ModelAndFile( readModel( pom, projectBuildCache ), pom, validProfilesXmlLocation );
+        // TODO: Cache the result of this readModel(..) call.
+        ModelAndFile current = new ModelAndFile( readModel( pom ), pom, validProfilesXmlLocation );
 
         do
         {
             if ( lineage.size() == 0 )
             {
-                lineage.setOrigin( current.model, current.file, currentRemoteRepositories, current.validProfilesXmlLocation );
+                lineage.setOrigin( current.getModel(),
+                                   current.getFile(),
+                                   currentRemoteRepositories,
+                                   current.isValidProfilesXmlLocation() );
             }
             else
             {
-                lineage.addParent( current.model, current.file, currentRemoteRepositories, current.validProfilesXmlLocation );
+                lineage.addParent( current.getModel(),
+                                   current.getFile(),
+                                   currentRemoteRepositories,
+                                   current.isValidProfilesXmlLocation() );
             }
 
-            currentRemoteRepositories = updateRepositorySet( current.model, currentRemoteRepositories, current.file, profileManager, current.validProfilesXmlLocation );
-
-            current = resolveParentPom( current, currentRemoteRepositories, localRepository, projectBuildCache, allowStubs );
+            currentRemoteRepositories = updateRepositorySet( current.getModel(),
+                                                             currentRemoteRepositories,
+                                                             current.getFile(),
+                                                             profileManager,
+                                                             current.isValidProfilesXmlLocation() );
+
+            current = resolveParentPom( current,
+                                        currentRemoteRepositories,
+                                        localRepository,
+                                        allowStubs );
         }
         while ( current != null );
 
         return lineage;
     }
 
-    public void resumeBuildingModelLineage( ModelLineage lineage, ArtifactRepository localRepository,
-                                            ProfileManager profileManager, boolean allowStubs )
+    public void resumeBuildingModelLineage( ModelLineage lineage,
+                                            ArtifactRepository localRepository,
+                                            ProfileManager profileManager,
+                                            boolean allowStubs )
         throws ProjectBuildingException
     {
         if ( lineage.size() == 0 )
         {
-            throw new ProjectBuildingException( "unknown", "Cannot resume a ModelLineage that doesn't contain at least one Model instance." );
+            throw new ProjectBuildingException( "unknown",
+                                                "Cannot resume a ModelLineage that doesn't contain at least one Model instance." );
         }
 
-        ProjectBuildCache projectBuildCache = ProjectBuildCache.read( buildContextManager );
-
         List currentRemoteRepositories = lineage.getDeepestAncestorArtifactRepositoryList();
 
         if ( currentRemoteRepositories == null )
@@ -138,18 +153,33 @@
             currentRemoteRepositories = new ArrayList();
         }
 
-        ModelAndFile current = new ModelAndFile( lineage.getDeepestAncestorModel(), lineage.getDeepestAncestorFile(), lineage.isDeepestAncestorUsingProfilesXml() );
+        ModelAndFile current = new ModelAndFile( lineage.getDeepestAncestorModel(),
+                                                 lineage.getDeepestAncestorFile(),
+                                                 lineage.isDeepestAncestorUsingProfilesXml() );
 
         // use the above information to re-bootstrap the resolution chain...
-        current = resolveParentPom( current, currentRemoteRepositories, localRepository, projectBuildCache, allowStubs );
+        current = resolveParentPom( current,
+                                    currentRemoteRepositories,
+                                    localRepository,
+                                    allowStubs );
 
         while ( current != null )
         {
-            lineage.addParent( current.model, current.file, currentRemoteRepositories, current.validProfilesXmlLocation );
-
-            currentRemoteRepositories = updateRepositorySet( current.model, currentRemoteRepositories, current.file, profileManager, current.validProfilesXmlLocation );
-
-            current = resolveParentPom( current, currentRemoteRepositories, localRepository, projectBuildCache, allowStubs );
+            lineage.addParent( current.getModel(),
+                               current.getFile(),
+                               currentRemoteRepositories,
+                               current.isValidProfilesXmlLocation() );
+
+            currentRemoteRepositories = updateRepositorySet( current.getModel(),
+                                                             currentRemoteRepositories,
+                                                             current.getFile(),
+                                                             profileManager,
+                                                             current.isValidProfilesXmlLocation() );
+
+            current = resolveParentPom( current,
+                                        currentRemoteRepositories,
+                                        localRepository,
+                                        allowStubs );
         }
     }
 
@@ -160,32 +190,9 @@
     private Model readModel( File pomFile )
         throws ProjectBuildingException
     {
-        return readModel( pomFile, null, true );
-    }
-
-    /**
-     * Read the Model instance from the given POM file, and cache it in the given Map before
-     * returning it.
-     */
-    private Model readModel( File pomFile, ProjectBuildCache projectBuildCache )
-        throws ProjectBuildingException
-    {
-        return readModel( pomFile, projectBuildCache, false );
-    }
-
-    /**
-     * Read the Model instance from the given POM file. Optionally (in normal cases) cache the
-     * Model instance in the given Map before returning it. The skipCache flag controls whether the
-     * Model instance is actually cached.
-     */
-    private Model readModel( File pom, ProjectBuildCache projectBuildCache, boolean skipCache )
-        throws ProjectBuildingException
-    {
-        File pomFile = pom;
-        if ( pom.isDirectory() )
+        if ( pomFile.isDirectory() )
         {
-            pomFile = new File( pom, "pom.xml" );
-//            getLogger().debug( "readModel(..): POM: " + pom + " is a directory. Trying: " + pomFile + " instead." );
+            pomFile = new File( pomFile, "pom.xml" );
         }
 
         Model model;
@@ -198,23 +205,20 @@
         }
         catch ( IOException e )
         {
-            throw new ProjectBuildingException( "unknown", "Failed to read model from: " + pomFile, pomFile, e );
+            throw new ProjectBuildingException( "unknown", "Failed to read model from: " + pomFile,
+                                                pomFile, e );
         }
         catch ( XmlPullParserException e )
         {
-            throw new ProjectBuildingException( "unknown", "Failed to parse model from: " + pomFile, pomFile, e );
+            throw new ProjectBuildingException( "unknown",
+                                                "Failed to parse model from: " + pomFile, pomFile,
+                                                e );
         }
         finally
         {
             IOUtil.close( reader );
         }
 
-        if ( !skipCache )
-        {
-            projectBuildCache.cacheModelFileForModel( pomFile, model );
-            projectBuildCache.store( buildContextManager );
-        }
-
         return model;
     }
 
@@ -224,8 +228,11 @@
      * The specified pomFile is used for error reporting.
      * @param profileManager
      */
-    private List updateRepositorySet( Model model, List oldArtifactRepositories, File pomFile,
-                                      ProfileManager externalProfileManager, boolean useProfilesXml )
+    private List updateRepositorySet( Model model,
+                                      List oldArtifactRepositories,
+                                      File pomFile,
+                                      ProfileManager externalProfileManager,
+                                      boolean useProfilesXml )
         throws ProjectBuildingException
     {
         List repositories = model.getRepositories();
@@ -241,47 +248,65 @@
                 List lastRemoteRepos = oldArtifactRepositories;
                 List remoteRepos = mavenTools.buildArtifactRepositories( repositories );
 
-                loadActiveProfileRepositories( remoteRepos, model, externalProfileManager, projectDir, useProfilesXml );
+                loadActiveProfileRepositories( remoteRepos,
+                                               model,
+                                               externalProfileManager,
+                                               projectDir,
+                                               useProfilesXml );
 
-                artifactRepositories = new LinkedHashSet( remoteRepos.size() + oldArtifactRepositories.size() );
+                artifactRepositories = new LinkedHashSet( remoteRepos.size()
+                                                          + oldArtifactRepositories.size() );
 
                 artifactRepositories.addAll( remoteRepos );
                 artifactRepositories.addAll( lastRemoteRepos );
             }
             catch ( InvalidRepositoryException e )
             {
-                throw new ProjectBuildingException( model.getId(), "Failed to create ArtifactRepository list for: "
-                    + pomFile, pomFile, e );
+                throw new ProjectBuildingException( model.getId(),
+                                                    "Failed to create ArtifactRepository list for: "
+                                                                    + pomFile, pomFile, e );
             }
         }
 
         return new ArrayList( artifactRepositories );
     }
 
-    private void loadActiveProfileRepositories( List repositories, Model model, ProfileManager profileManager,
-                                                File pomFile, boolean useProfilesXml )
+    private void loadActiveProfileRepositories( List repositories,
+                                                Model model,
+                                                ProfileManager profileManager,
+                                                File pomFile,
+                                                boolean useProfilesXml )
         throws ProjectBuildingException
     {
         List explicitlyActive;
         List explicitlyInactive;
 
+        // FIXME: Find a way to pass in this context, so it's never null!
+        ProfileActivationContext context;
+
         if ( profileManager != null )
         {
             explicitlyActive = profileManager.getExplicitlyActivatedIds();
             explicitlyInactive = profileManager.getExplicitlyDeactivatedIds();
+            context = profileManager.getProfileActivationContext();
         }
         else
         {
             explicitlyActive = Collections.EMPTY_LIST;
             explicitlyInactive = Collections.EMPTY_LIST;
+            context = new DefaultProfileActivationContext( System.getProperties(), false );
         }
 
-        LinkedHashSet profileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( profileManager, pomFile, model.getId() );
-
-        profileRepos.addAll( profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model, pomFile,
-                                                                                               explicitlyActive,
-                                                                                               explicitlyInactive,
-                                                                                               useProfilesXml ) );
+        LinkedHashSet profileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( profileManager,
+                                                                                               pomFile,
+                                                                                               model.getId() );
+
+        profileRepos.addAll( profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model,
+                                                                                       pomFile,
+                                                                                       explicitlyActive,
+                                                                                       explicitlyInactive,
+                                                                                       useProfilesXml,
+                                                                                       context ) );
 
         if ( !profileRepos.isEmpty() )
         {
@@ -295,12 +320,14 @@
      * @param projectBuildCache
      * @param allowStubs
      */
-    private ModelAndFile resolveParentPom( ModelAndFile child, List remoteRepositories, ArtifactRepository localRepository,
-                                   ProjectBuildCache projectBuildCache, boolean allowStubs )
+    private ModelAndFile resolveParentPom( ModelAndFile child,
+                                           List remoteRepositories,
+                                           ArtifactRepository localRepository,
+                                           boolean allowStubs )
         throws ProjectBuildingException
     {
-        Model model = child.model;
-        File modelPomFile = child.file;
+        Model model = child.getModel();
+        File modelPomFile = child.getFile();
 
         Parent modelParent = model.getParent();
 
@@ -308,11 +335,11 @@
 
         if ( modelParent != null )
         {
-              validateParentDeclaration( modelParent, model );
+            validateParentDeclaration( modelParent, model );
 
-            File parentPomFile = projectBuildCache.getCachedModelFile( modelParent );
+            File parentPomFile = null;
 
-            if ( ( parentPomFile == null ) && ( modelPomFile != null ) )
+            if ( ( modelPomFile != null ) )
             {
                 parentPomFile = resolveParentWithRelativePath( modelParent, modelPomFile );
             }
@@ -323,14 +350,21 @@
             {
                 try
                 {
-                    parentPomFile = resolveParentFromRepositories( modelParent, localRepository, remoteRepositories, model.getId(), modelPomFile );
+                    parentPomFile = resolveParentFromRepositories( modelParent,
+                                                                   localRepository,
+                                                                   remoteRepositories,
+                                                                   model.getId(),
+                                                                   modelPomFile );
                     isResolved = true;
                 }
-                catch( ProjectBuildingException e )
+                catch ( ProjectBuildingException e )
                 {
                     if ( allowStubs )
                     {
-                        getLogger().debug( "DISREGARDING the error encountered while resolving artifact for: " + modelParent.getId() + ", building a stub model in its place.", e );
+                        getLogger().debug( "DISREGARDING the error encountered while resolving artifact for: "
+                                                           + modelParent.getId()
+                                                           + ", building a stub model in its place.",
+                                           e );
                         parentPomFile = null;
                     }
                     else
@@ -344,7 +378,9 @@
             {
                 if ( allowStubs )
                 {
-                    getLogger().warn( "Cannot find parent POM: " + modelParent.getId() + " for child: " + model.getId() + ". Using stub model instead." );
+                    getLogger().warn( "Cannot find parent POM: " + modelParent.getId()
+                                      + " for child: " + model.getId()
+                                      + ". Using stub model instead." );
 
                     Model parent = new Model();
 
@@ -372,35 +408,44 @@
         return result;
     }
 
-    private void validateParentDeclaration( Parent modelParent, Model model )
+    private void validateParentDeclaration( Parent modelParent,
+                                            Model model )
         throws ProjectBuildingException
     {
         if ( StringUtils.isEmpty( modelParent.getGroupId() ) )
         {
-            throw new ProjectBuildingException( model.getId(), "Missing groupId element from parent element" );
+            throw new ProjectBuildingException( model.getId(),
+                                                "Missing groupId element from parent element" );
         }
         else if ( StringUtils.isEmpty( modelParent.getArtifactId() ) )
         {
-            throw new ProjectBuildingException( model.getId(), "Missing artifactId element from parent element" );
+            throw new ProjectBuildingException( model.getId(),
+                                                "Missing artifactId element from parent element" );
         }
         else if ( modelParent.getGroupId().equals( model.getGroupId() )
-            && modelParent.getArtifactId().equals( model.getArtifactId() ) )
+                  && modelParent.getArtifactId().equals( model.getArtifactId() ) )
         {
             throw new ProjectBuildingException( model.getId(), "Parent element is a duplicate of "
-                + "the current project " );
+                                                               + "the current project " );
         }
         else if ( StringUtils.isEmpty( modelParent.getVersion() ) )
         {
-            throw new ProjectBuildingException( model.getId(), "Missing version element from parent element" );
+            throw new ProjectBuildingException( model.getId(),
+                                                "Missing version element from parent element" );
         }
     }
 
-    private File resolveParentFromRepositories( Parent modelParent, ArtifactRepository localRepository,
-                                                List remoteRepositories, String childId, File childPomFile )
+    private File resolveParentFromRepositories( Parent modelParent,
+                                                ArtifactRepository localRepository,
+                                                List remoteRepositories,
+                                                String childId,
+                                                File childPomFile )
         throws ProjectBuildingException
     {
-        Artifact parentPomArtifact = artifactFactory.createBuildArtifact( modelParent.getGroupId(), modelParent
-            .getArtifactId(), modelParent.getVersion(), "pom" );
+        Artifact parentPomArtifact = artifactFactory.createBuildArtifact( modelParent.getGroupId(),
+                                                                          modelParent.getArtifactId(),
+                                                                          modelParent.getVersion(),
+                                                                          "pom" );
 
         try
         {
@@ -408,11 +453,13 @@
         }
         catch ( ArtifactResolutionException e )
         {
-            throw new ProjectBuildingException( childId, "Failed to resolve parent POM: " + modelParent.getId(), childPomFile, e );
+            throw new ProjectBuildingException( childId, "Failed to resolve parent POM: "
+                                                         + modelParent.getId(), childPomFile, e );
         }
         catch ( ArtifactNotFoundException e )
         {
-            throw new ProjectBuildingException( childId, "Cannot find artifact for parent POM: " + modelParent.getId(), childPomFile, e );
+            throw new ProjectBuildingException( childId, "Cannot find artifact for parent POM: "
+                                                         + modelParent.getId(), childPomFile, e );
         }
 
         if ( parentPomArtifact.isResolved() )
@@ -425,7 +472,8 @@
         }
     }
 
-    private File resolveParentWithRelativePath( Parent modelParent, File modelPomFile )
+    private File resolveParentWithRelativePath( Parent modelParent,
+                                                File modelPomFile )
         throws ProjectBuildingException
     {
         String relativePath = modelParent.getRelativePath();
@@ -446,11 +494,12 @@
             Model parentModel = readModel( parentPomFile );
 
             boolean groupsMatch = ( parentModel.getGroupId() == null )
-                || parentModel.getGroupId().equals( modelParent.getGroupId() );
+                                  || parentModel.getGroupId().equals( modelParent.getGroupId() );
             boolean versionsMatch = ( parentModel.getVersion() == null )
-                || parentModel.getVersion().equals( modelParent.getVersion() );
+                                    || parentModel.getVersion().equals( modelParent.getVersion() );
 
-            if ( groupsMatch && versionsMatch && parentModel.getArtifactId().equals( modelParent.getArtifactId() ) )
+            if ( groupsMatch && versionsMatch
+                 && parentModel.getArtifactId().equals( modelParent.getArtifactId() ) )
             {
                 return parentPomFile;
             }
@@ -472,20 +521,6 @@
     public void enableLogging( Logger logger )
     {
         this.logger = logger;
-    }
-
-    private static final class ModelAndFile
-    {
-        private final Model model;
-        private final File file;
-        private final boolean validProfilesXmlLocation;
-
-        ModelAndFile( Model model, File file, boolean validProfilesXmlLocation )
-        {
-            this.model = model;
-            this.file = file;
-            this.validProfilesXmlLocation = validProfilesXmlLocation;
-        }
     }
 
 }

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelAndFile.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelAndFile.java?rev=595215&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelAndFile.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelAndFile.java Wed Nov 14 21:37:55 2007
@@ -0,0 +1,40 @@
+package org.apache.maven.project.build.model;
+
+import org.apache.maven.model.Model;
+
+import java.io.File;
+
+public class ModelAndFile
+{
+
+    private final Model model;
+
+    private final File file;
+
+    private final boolean validProfilesXmlLocation;
+
+    ModelAndFile( Model model,
+                  File file,
+                  boolean validProfilesXmlLocation )
+    {
+        this.model = model;
+        this.file = file;
+        this.validProfilesXmlLocation = validProfilesXmlLocation;
+    }
+
+    public Model getModel()
+    {
+        return model;
+    }
+
+    public File getFile()
+    {
+        return file;
+    }
+
+    public boolean isValidProfilesXmlLocation()
+    {
+        return validProfilesXmlLocation;
+    }
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelAndFile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelAndFile.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelLineageBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelLineageBuilder.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelLineageBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/build/model/ModelLineageBuilder.java Wed Nov 14 21:37:55 2007
@@ -41,9 +41,6 @@
     /**
      * Construct a lineage of the current POM plus all of its ancestors.
      *
-     * COMING: Also, set ProjectBuildContext.currentModelLineage build-context to the result of this
-     * method before returning.
-     *
      * @param pom The current POM, whose Model will terminate the constructed lineage
      * @param localRepository The local repository against which parent POMs should be resolved
      * @param remoteRepositories List of ArtifactRepository instances against which parent POMs

Modified: maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml Wed Nov 14 21:37:55 2007
@@ -19,39 +19,6 @@
 
 <component-set>
   <components>
-    <!--
-     |
-     | Resolver
-     |
-     -->
-    <component>
-      <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
-      <implementation>org.apache.maven.project.artifact.CacheAwareArtifactResolver</implementation>
-      <role-hint>project-cache-aware</role-hint>
-      <requirements>
-        <requirement>
-          <role>org.apache.maven.artifact.manager.WagonManager</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.artifact.transform.ArtifactTransformationManager</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.artifact.resolver.ArtifactCollector</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
-          <role-hint>default</role-hint>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
-      </requirements>
-    </component>
-
     <component>
       <role>org.apache.maven.profiles.build.ProfileAdvisor</role>
       <role-hint>default</role-hint>
@@ -86,11 +53,6 @@
         </requirement>
         <requirement>
           <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
-          <role-hint>project-cache-aware</role-hint>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
         </requirement>
       </requirements>
     </component>
@@ -182,10 +144,6 @@
           <role-hint>default</role-hint>
         </requirement>
         <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
-        <requirement>
           <role>org.apache.maven.MavenTools</role>
         </requirement>
       </requirements>
@@ -209,12 +167,6 @@
       <role>org.apache.maven.profiles.activation.ProfileActivator</role>
       <role-hint>jdk-prefix</role-hint>
       <implementation>org.apache.maven.profiles.activation.JdkPrefixProfileActivator</implementation>
-      <requirements>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
-      </requirements>
     </component>
 <!--
      |
@@ -225,12 +177,6 @@
       <role>org.apache.maven.profiles.activation.ProfileActivator</role>
       <role-hint>system-property</role-hint>
       <implementation>org.apache.maven.profiles.activation.SystemPropertyProfileActivator</implementation>
-      <requirements>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
-      </requirements>
     </component>
     <!--
      |
@@ -261,12 +207,6 @@
       <role>org.apache.maven.profiles.activation.ProfileActivator</role>
       <role-hint>custom</role-hint>
       <implementation>org.apache.maven.profiles.activation.CustomActivator</implementation>
-      <requirements>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
-      </requirements>
     </component>
 <!--
      |
@@ -318,10 +258,6 @@
         <requirement>
           <role>org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager</role>
         </requirement>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
       </requirements>
     </component>
 
@@ -336,10 +272,6 @@
         <requirement>
           <role>org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager</role>
         </requirement>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
-        </requirement>
       </requirements>
     </component>
 
@@ -350,10 +282,6 @@
       <requirements>
         <requirement>
           <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.context.BuildContextManager</role>
-          <role-hint>default</role-hint>
         </requirement>
       </requirements>
     </component>

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivatorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivatorTest.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivatorTest.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivatorTest.java Wed Nov 14 21:37:55 2007
@@ -19,34 +19,19 @@
  * under the License.
  */
 
-import org.apache.maven.context.BuildContextManager;
-import org.apache.maven.context.DefaultBuildContextManager;
-import org.apache.maven.context.SystemBuildContext;
 import org.apache.maven.model.Activation;
 import org.apache.maven.model.ActivationProperty;
 import org.apache.maven.model.Profile;
-import org.codehaus.plexus.PlexusTestCase;
 
 import java.util.Properties;
 
+import junit.framework.TestCase;
+
 public class SystemPropertyProfileActivatorTest
-    extends PlexusTestCase
+    extends TestCase
 {
-    
-    private BuildContextManager buildContextManager;
-    private SystemPropertyProfileActivator activator;
-    
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        
-        buildContextManager = (BuildContextManager) lookup( BuildContextManager.ROLE, DefaultBuildContextManager.ROLE_HINT );
-        
-        SystemBuildContext sysContext = SystemBuildContext.getSystemBuildContext( buildContextManager, true );
-        sysContext.store( buildContextManager );
-        
-        activator = (SystemPropertyProfileActivator) lookup( ProfileActivator.ROLE, "system-property" );
-    }
+
+    private SystemPropertyProfileActivator activator = new SystemPropertyProfileActivator();
 
     public void testCanDetect_ShouldReturnTrueWhenActivationPropertyIsPresent()
         throws Exception
@@ -62,7 +47,10 @@
 
         profile.setActivation( activation );
 
-        assertTrue( activator.canDetermineActivation( profile ) );
+        Properties props = new Properties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        assertTrue( activator.canDetermineActivation( profile, ctx ) );
     }
 
     public void testCanDetect_ShouldReturnFalseWhenActivationPropertyIsNotPresent()
@@ -74,7 +62,10 @@
 
         profile.setActivation( activation );
 
-        assertFalse( activator.canDetermineActivation( profile ) );
+        Properties props = new Properties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        assertFalse( activator.canDetermineActivation( profile, ctx ) );
     }
 
     public void testIsActive_ShouldReturnTrueWhenPropertyNameSpecifiedAndPresent()
@@ -91,9 +82,11 @@
 
         profile.setActivation( activation );
 
-        System.setProperty( "test", "true" );
+        Properties props = new Properties();
+        props.setProperty( "test", "true" );
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
 
-        assertTrue( activator.isActive( profile ) );
+        assertTrue( activator.isActive( profile, ctx ) );
     }
 
     public void testIsActive_ShouldReturnFalseWhenPropertyNameSpecifiedAndMissing()
@@ -110,11 +103,10 @@
 
         profile.setActivation( activation );
 
-        Properties props = System.getProperties();
-        props.remove( "test" );
-        System.setProperties( props );
+        Properties props = new Properties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
 
-        assertFalse( activator.isActive( profile ) );
+        assertFalse( activator.isActive( profile, ctx ) );
     }
 
 }

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java Wed Nov 14 21:37:55 2007
@@ -19,63 +19,59 @@
  * under the License.
  */
 
-import org.apache.maven.context.BuildContextManager;
-import org.apache.maven.context.DefaultBuildContextManager;
-import org.apache.maven.context.SystemBuildContext;
 import org.apache.maven.model.Activation;
 import org.apache.maven.model.ActivationOS;
 import org.apache.maven.model.ActivationProperty;
 import org.apache.maven.model.Profile;
-import org.apache.maven.profiles.activation.ProfileActivationException;
-import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.profiles.DefaultProfileManager;
+import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
+import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.util.List;
+import java.util.Properties;
 
 public class DefaultProfileManagerTest
     extends PlexusTestCase
 {
-    
-    private BuildContextManager buildContextManager;
-    
+
     public void setUp() throws Exception
     {
         super.setUp();
-        
-        buildContextManager = (BuildContextManager) lookup( BuildContextManager.ROLE, DefaultBuildContextManager.ROLE_HINT );
     }
-    
+
     public void testShouldActivateDefaultProfile() throws ProfileActivationException
     {
-        SystemBuildContext sysContext = SystemBuildContext.getSystemBuildContext( buildContextManager, true );
-        sysContext.store( buildContextManager );
-        
         Profile notActivated = new Profile();
         notActivated.setId("notActivated");
-        
+
         Activation nonActivation = new Activation();
-        
+
         nonActivation.setJdk("19.2");
-        
+
         notActivated.setActivation( nonActivation );
-        
+
         Profile defaultActivated = new Profile();
         defaultActivated.setId("defaultActivated");
-        
+
         Activation defaultActivation = new Activation();
-        
+
         defaultActivation.setActiveByDefault(true);
-        
+
         defaultActivated.setActivation( defaultActivation );
-        
-        ProfileManager profileManager = new DefaultProfileManager(getContainer());
-        
+
+        Properties props = new Properties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
+
         profileManager.addProfile(notActivated);
         profileManager.addProfile(defaultActivated);
-        
+
         List active = profileManager.getActiveProfiles();
-        
+
         assertNotNull( active );
         assertEquals( 1, active.size() );
         assertEquals("defaultActivated", ((Profile)active.get(0)).getId());
@@ -83,37 +79,37 @@
 
     public void testShouldNotActivateDefaultProfile() throws ProfileActivationException
     {
-        SystemBuildContext sysContext = SystemBuildContext.getSystemBuildContext( buildContextManager, true );
-        sysContext.store( buildContextManager );
-        
         Profile syspropActivated = new Profile();
         syspropActivated.setId("syspropActivated");
-        
+
         Activation syspropActivation = new Activation();
-        
+
         ActivationProperty syspropProperty = new ActivationProperty();
         syspropProperty.setName("java.version");
-        
+
         syspropActivation.setProperty(syspropProperty);
-        
+
         syspropActivated.setActivation( syspropActivation );
-        
+
         Profile defaultActivated = new Profile();
         defaultActivated.setId("defaultActivated");
-        
+
         Activation defaultActivation = new Activation();
-        
+
         defaultActivation.setActiveByDefault(true);
-        
+
         defaultActivated.setActivation( defaultActivation );
-        
-        ProfileManager profileManager = new DefaultProfileManager(getContainer());
-        
+
+        Properties props = System.getProperties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
+
         profileManager.addProfile(syspropActivated);
         profileManager.addProfile(defaultActivated);
-        
+
         List active = profileManager.getActiveProfiles();
-        
+
         assertNotNull( active );
         assertEquals( 1, active.size() );
         assertEquals("syspropActivated", ((Profile)active.get(0)).getId());
@@ -121,27 +117,27 @@
 
     public void testShouldNotActivateReversalOfPresentSystemProperty() throws ProfileActivationException
     {
-        SystemBuildContext sysContext = SystemBuildContext.getSystemBuildContext( buildContextManager, true );
-        sysContext.store( buildContextManager );
-        
         Profile syspropActivated = new Profile();
         syspropActivated.setId("syspropActivated");
-        
+
         Activation syspropActivation = new Activation();
-        
+
         ActivationProperty syspropProperty = new ActivationProperty();
         syspropProperty.setName("!java.version");
-        
+
         syspropActivation.setProperty(syspropProperty);
-        
+
         syspropActivated.setActivation( syspropActivation );
-        
-        ProfileManager profileManager = new DefaultProfileManager(getContainer());
-        
+
+        Properties props = System.getProperties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
+
         profileManager.addProfile(syspropActivated);
-        
+
         List active = profileManager.getActiveProfiles();
-        
+
         assertNotNull( active );
         assertEquals( 0, active.size() );
     }
@@ -150,24 +146,27 @@
     {
         Profile syspropActivated = new Profile();
         syspropActivated.setId("syspropActivated");
-        
+
         Activation syspropActivation = new Activation();
-        
+
         ActivationProperty syspropProperty = new ActivationProperty();
         syspropProperty.setName("!java.version");
-        
+
         syspropActivation.setProperty(syspropProperty);
-        
+
         syspropActivated.setActivation( syspropActivation );
-        
-        ProfileManager profileManager = new DefaultProfileManager(getContainer());
-        
+
+        Properties props = System.getProperties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
+
         profileManager.addProfile(syspropActivated);
-        
+
         profileManager.explicitlyActivate("syspropActivated");
-        
+
         List active = profileManager.getActiveProfiles();
-        
+
         assertNotNull( active );
         assertEquals( 1, active.size() );
         assertEquals( "syspropActivated", ((Profile)active.get(0)).getId());
@@ -177,24 +176,27 @@
     {
         Profile syspropActivated = new Profile();
         syspropActivated.setId("syspropActivated");
-        
+
         Activation syspropActivation = new Activation();
-        
+
         ActivationProperty syspropProperty = new ActivationProperty();
         syspropProperty.setName("java.version");
-        
+
         syspropActivation.setProperty(syspropProperty);
-        
+
         syspropActivated.setActivation( syspropActivation );
-        
-        ProfileManager profileManager = new DefaultProfileManager(getContainer());
-        
+
+        Properties props = System.getProperties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
+
         profileManager.addProfile(syspropActivated);
-        
+
         profileManager.explicitlyDeactivate("syspropActivated");
-        
+
         List active = profileManager.getActiveProfiles();
-        
+
         assertNotNull( active );
         assertEquals( 0, active.size() );
     }
@@ -214,7 +216,10 @@
 
         osActivated.setActivation(osActivation);
 
-        ProfileManager profileManager = new DefaultProfileManager(getContainer());
+        Properties props = System.getProperties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), ctx );
 
         profileManager.addProfile(osActivated);
 

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java?rev=595215&r1=595214&r2=595215&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java Wed Nov 14 21:37:55 2007
@@ -23,6 +23,8 @@
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.profiles.DefaultProfileManager;
+import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.File;
@@ -30,6 +32,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.Properties;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@@ -109,7 +112,10 @@
     protected MavenProject getProject( File pom )
         throws Exception
     {
-        return projectBuilder.build( pom, getLocalRepository(), new DefaultProfileManager( getContainer() ) );
+        Properties props = System.getProperties();
+        ProfileActivationContext ctx = new DefaultProfileActivationContext( props, false );
+
+        return projectBuilder.build( pom, getLocalRepository(), new DefaultProfileManager( getContainer(), ctx ) );
     }
 
 }