maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r727299 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/plugin/ maven-mercury/src/main/java/org/apache/maven/mercury/ maven-project-builder/src/main/java/org/apache/maven/project/builder/ maven-project/src/main/java/...
Date Wed, 17 Dec 2008 06:27:17 GMT
Author: jvanzyl
Date: Tue Dec 16 22:27:16 2008
New Revision: 727299

URL: http://svn.apache.org/viewvc?rev=727299&view=rev
Log:
o collapsing more of the project builder, trying to turn it back into one component -- we
have the old and the new with the old wrapper the new -- so that I can have an interface for
compatibility and then all our new stuff in another component.

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomInterpolatorTag.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/SuperPomProjectBuilderTest.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=727299&r1=727298&r2=727299&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Tue Dec 16 22:27:16 2008
@@ -566,7 +566,7 @@
                 List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
                 
                 interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties(
session.getProjectBuilderConfiguration().getExecutionProperties(),
-                        PomInterpolatorTag.SYSTEM_PROPERTIES.name()));
+                        PomInterpolatorTag.EXECUTION_PROPERTIES.name()));
                 
                 interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties(
session.getProjectBuilderConfiguration().getUserProperties(),
                         PomInterpolatorTag.USER_PROPERTIES.name()));

Modified: maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java?rev=727299&r1=727298&r2=727299&view=diff
==============================================================================
--- maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
(original)
+++ maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
Tue Dec 16 22:27:16 2008
@@ -71,12 +71,12 @@
 
         List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
         interpolatorProperties.add( new InterpolatorProperty( "${mavenVersion}", "3.0-SNAPSHOT",
-                                                              PomInterpolatorTag.SYSTEM_PROPERTIES.name()
) );
+                                                              PomInterpolatorTag.EXECUTION_PROPERTIES.name()
) );
 
         if ( system != null )
         {
             interpolatorProperties.addAll(
-                InterpolatorProperty.toInterpolatorProperties( system, PomInterpolatorTag.SYSTEM_PROPERTIES.name()
) );
+                InterpolatorProperty.toInterpolatorProperties( system, PomInterpolatorTag.EXECUTION_PROPERTIES.name()
) );
         }
         if ( user != null )
         {

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomInterpolatorTag.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomInterpolatorTag.java?rev=727299&r1=727298&r2=727299&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomInterpolatorTag.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomInterpolatorTag.java
Tue Dec 16 22:27:16 2008
@@ -8,7 +8,5 @@
 
     PROJECT_PROPERTIES,
 
-    SYSTEM_PROPERTIES
-
-
+    EXECUTION_PROPERTIES
 }

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=727299&r1=727298&r2=727299&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
Tue Dec 16 22:27:16 2008
@@ -22,9 +22,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -46,7 +43,6 @@
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Profile;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.profiles.MavenProfilesBuilder;
 import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
@@ -55,7 +51,6 @@
 import org.apache.maven.profiles.build.ProfileAdvisor;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
 import org.apache.maven.project.builder.DefaultPomArtifactResolver;
-import org.apache.maven.project.builder.Interpolator;
 import org.apache.maven.project.builder.PomArtifactResolver;
 import org.apache.maven.project.builder.PomInterpolatorTag;
 import org.apache.maven.project.builder.ProjectBuilder;
@@ -218,98 +213,34 @@
 
     /**
      * This is used for pom-less execution like running archetype:generate.
+     * 
+     * I am taking out the profile handling and the interpolation of the base directory until
we spec
+     * this out properly.
      */
     public MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration config )
         throws ProjectBuildingException
     {
         Model superModel = getSuperModel();
-               
-        ProfileManager profileManager = config.getGlobalProfileManager();
-
-        List activeProfiles = new ArrayList();
-        if ( profileManager != null )
-        {
-            List activated = profileAdvisor.applyActivatedProfiles( superModel, null, false,
-                                                                    profileManager.getProfileActivationContext()
);
-            if ( !activated.isEmpty() )
-            {
-                activeProfiles.addAll( activated );
-            }
-
-            activated = profileAdvisor.applyActivatedExternalProfiles( superModel, null,
profileManager );
-            if ( !activated.isEmpty() )
-            {
-                activeProfiles.addAll( activated );
-            }
-        }
-
-        List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
-        
-        interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getExecutionProperties(),
-                PomInterpolatorTag.SYSTEM_PROPERTIES.name()));
+                       
+        MavenProject project = null;
         
-        interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getUserProperties(),
-                PomInterpolatorTag.USER_PROPERTIES.name()));
-
-        if(config.getBuildStartTime() != null)
-        {
-            interpolatorProperties.add(new InterpolatorProperty("${build.timestamp}",
-                new SimpleDateFormat("yyyyMMdd-hhmm").format( config.getBuildStartTime()
),
-                PomInterpolatorTag.PROJECT_PROPERTIES.name()));
-        }
-
-        File basedir = null;
-        for(InterpolatorProperty ip : interpolatorProperties )
-        {
-            if(ip.getKey().equals("${basedir}"))
-            {
-                basedir = new File(ip.getValue());
-                break;
-            }
-        }
-
-        if(basedir == null)
-        {
-            String bd = System.getProperty("basedir");
-            if( bd != null )
-            {
-                basedir = new File(bd);
-            }
-        }
-
-        try
-        {
-            superModel = Interpolator.interpolateModel(superModel, interpolatorProperties,
basedir );
-        }
-        catch (IOException e)
-        {
-            throw new ProjectBuildingException(STANDALONE_SUPERPOM_GROUPID + ":" + STANDALONE_SUPERPOM_ARTIFACTID,
"Interpolation failure:", e);
-        }
-
-        MavenProject project;
         try
         {
             project = new MavenProject( superModel, artifactFactory, mavenTools, this, config
);
         }
         catch ( InvalidRepositoryException e )
         {
-            throw new ProjectBuildingException( STANDALONE_SUPERPOM_GROUPID + ":" + STANDALONE_SUPERPOM_ARTIFACTID,
-                                                "Maven super-POM contains an invalid repository!",
e );
+            // Not going to happen.
         }
 
-        getLogger().debug( "Activated the following profiles for standalone super-pom: "
+ activeProfiles );
-
         try
         {
-            project = constructMavenProjectFromModel( project.getModel(), null, null, config
);
-            project.setActiveProfiles( activeProfiles );
             project.setRemoteArtifactRepositories( mavenTools.buildArtifactRepositories(
superModel.getRepositories() ) );
             project.setPluginArtifactRepositories( mavenTools.buildArtifactRepositories(
superModel.getRepositories() ) );
         }
         catch ( InvalidRepositoryException e )
         {
-            throw new ProjectBuildingException( STANDALONE_SUPERPOM_GROUPID + ":" + STANDALONE_SUPERPOM_ARTIFACTID,
-                                                "Maven super-POM contains an invalid repository!",
e );
+            // Not going to happen.
         }
 
         project.setExecutionRoot( true );
@@ -391,7 +322,16 @@
         
         try
         {
-            project = constructMavenProjectFromModel( model, projectDescriptor, parentDescriptor,
config );
+            project = new MavenProject( model, artifactFactory, mavenTools, this, config
);
+            
+            validateModel( model, projectDescriptor );
+
+            Artifact projectArtifact = artifactFactory.createBuildArtifact( project.getGroupId(),
project.getArtifactId(),
+                                                                            project.getVersion(),
project.getPackaging() );
+            project.setArtifact( projectArtifact );
+            
+            project.setParentFile( parentDescriptor );
+            
         }
         catch ( InvalidRepositoryException e )
         {
@@ -409,22 +349,6 @@
         return project;
     }
 
-    private MavenProject constructMavenProjectFromModel( Model model, File pomFile, File
parentFile,
-                                                           ProjectBuilderConfiguration config
)
-            throws ProjectBuildingException, InvalidRepositoryException
-    {
-
-        MavenProject project = new MavenProject( model, artifactFactory, mavenTools, this,
config );
-        validateModel( model, pomFile );
-
-        Artifact projectArtifact = artifactFactory.createBuildArtifact( project.getGroupId(),
project.getArtifactId(),
-                                                                        project.getVersion(),
project.getPackaging() );
-        project.setArtifact( projectArtifact );
-        project.setParentFile( parentFile );
-
-        return project;
-    }
-
     private MavenProject superProject;
     
     private MavenProject getSuperProject( ProjectBuilderConfiguration config, File projectDescriptor
)
@@ -489,7 +413,7 @@
         List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
         
         interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getExecutionProperties(),

-                PomInterpolatorTag.SYSTEM_PROPERTIES.name()));
+                PomInterpolatorTag.EXECUTION_PROPERTIES.name()));
         
         interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( config.getUserProperties(),
                 PomInterpolatorTag.USER_PROPERTIES.name()));
@@ -501,14 +425,14 @@
                 PomInterpolatorTag.PROJECT_PROPERTIES.name()));
         }
 
-        interpolatorProperties.add(new InterpolatorProperty("${mavenVersion}", MavenProjectBuilder.STANDALONE_SUPERPOM_VERSION,
PomInterpolatorTag.SYSTEM_PROPERTIES.name()));
+        interpolatorProperties.add(new InterpolatorProperty("${mavenVersion}", MavenProjectBuilder.STANDALONE_SUPERPOM_VERSION,
PomInterpolatorTag.EXECUTION_PROPERTIES.name()));
         
         MavenProject mavenProject;
         
         try
         {
             mavenProject = projectBuilder.buildFromLocalPath( projectDescriptor, 
-                                                              Arrays.asList( getSuperProject(
config, projectDescriptor ).getModel() ), 
+                                                              Arrays.asList( getSuperModel()
), 
                                                               interpolatorProperties, 
                                                               resolver,
                                                               config );

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/SuperPomProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/SuperPomProjectBuilderTest.java?rev=727299&r1=727298&r2=727299&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/SuperPomProjectBuilderTest.java
(original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/SuperPomProjectBuilderTest.java
Tue Dec 16 22:27:16 2008
@@ -41,33 +41,6 @@
         projectBuilder = lookup( MavenProjectBuilder.class );
     }
 
-    public void testStandaloneSuperPomContainsInjectedExternalProfileRepositories()
-        throws Exception
-    {
-        Profile profile = new Profile();
-        profile.setId( "test-profile" );
-
-        Repository repo = new Repository();
-        repo.setId( "test" );
-        repo.setUrl( "http://www.nowhere.com" );
-
-        profile.addRepository( repo );
-
-        ProfileManager pm = new DefaultProfileManager( getContainer(), new DefaultProfileActivationContext(
new Properties(), true ) );
-
-        pm.addProfile( profile );
-        pm.explicitlyActivate( profile.getId() );
-
-        ProjectBuilderConfiguration pbc = new DefaultProjectBuilderConfiguration();
-        pbc.setGlobalProfileManager( pm );
-        MavenProject project = projectBuilder.buildStandaloneSuperProject( pbc );
-
-        assertRepository( repo.getId(), project.getRepositories() );
-        assertRepository( repo.getId(), project.getPluginRepositories() );
-        assertArtifactRepository( repo.getId(), project.getRemoteArtifactRepositories() );
-        assertArtifactRepository( repo.getId(), project.getPluginArtifactRepositories() );
-    }
-
     public void testStandaloneSuperPomContainsCentralRepo()
         throws ProjectBuildingException
     {



Mime
View raw message