Author: jdcasey Date: Thu Jun 9 08:53:31 2005 New Revision: 189768 URL: http://svn.apache.org/viewcvs?rev=189768&view=rev Log: Fixed problems with merging profile-defined properties into the project, and fixed the ITs testing profile definitions in the process.
This should finally resolve MNG-421 Removed: maven/components/trunk/maven-core-it/it0022/src/test/ maven/components/trunk/maven-core-it/it0023/src/test/ Modified: maven/components/trunk/maven-core-it/integration-tests.txt maven/components/trunk/maven-core-it/it0022/expected-results.txt maven/components/trunk/maven-core-it/it0022/goals.txt maven/components/trunk/maven-core-it/it0022/pom.xml maven/components/trunk/maven-core-it/it0022/profiles.xml maven/components/trunk/maven-core-it/it0023/expected-results.txt maven/components/trunk/maven-core-it/it0023/goals.txt maven/components/trunk/maven-core-it/it0023/pom.xml maven/components/trunk/maven-core-it/it0023/settings.xml maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java maven/components/trunk/maven-model/maven.mdo maven/components/trunk/maven-model/pom.xml maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java Modified: maven/components/trunk/maven-core-it/integration-tests.txt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/integration-tests.txt?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/integration-tests.txt (original) +++ maven/components/trunk/maven-core-it/integration-tests.txt Thu Jun 9 08:53:31 2005 @@ -20,5 +20,5 @@ it0019 it0020 it0021 -#it0022 -#it0023 +it0022 +it0023 Modified: maven/components/trunk/maven-core-it/it0022/expected-results.txt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/expected-results.txt?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0022/expected-results.txt (original) +++ maven/components/trunk/maven-core-it/it0022/expected-results.txt Thu Jun 9 08:53:31 2005 @@ -1 +1 @@ -target/classes/org/apache/maven/it0022/test.txt +target/test.txt Modified: maven/components/trunk/maven-core-it/it0022/goals.txt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/goals.txt?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0022/goals.txt (original) +++ maven/components/trunk/maven-core-it/it0022/goals.txt Thu Jun 9 08:53:31 2005 @@ -1 +1 @@ -package \ No newline at end of file +core-it:touch \ No newline at end of file Modified: maven/components/trunk/maven-core-it/it0022/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/pom.xml?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0022/pom.xml (original) +++ maven/components/trunk/maven-core-it/it0022/pom.xml Thu Jun 9 08:53:31 2005 @@ -4,23 +4,21 @@ <artifactId>maven-it0022</artifactId> <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - </dependency> - </dependencies> - <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> + <artifactId>maven-core-it-plugin</artifactId> + <version>1.0-SNAPSHOT</version> <configuration> - <test>${test}</test> + <pluginItem>${test}</pluginItem> </configuration> </plugin> + <!-- plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-projecthelp-plugin</artifactId> + <version>2.0-alpha-3-SNAPSHOT</version> + </plugin --> </plugins> </build> -</model> \ No newline at end of file +</model> Modified: maven/components/trunk/maven-core-it/it0022/profiles.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/profiles.xml?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0022/profiles.xml (original) +++ maven/components/trunk/maven-core-it/it0022/profiles.xml Thu Jun 9 08:53:31 2005 @@ -10,7 +10,7 @@ </activation> <properties> - <test>**/SomeAddTest*</test> + <test>test.txt</test> </properties> </profile> </profiles> Modified: maven/components/trunk/maven-core-it/it0023/expected-results.txt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/expected-results.txt?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0023/expected-results.txt (original) +++ maven/components/trunk/maven-core-it/it0023/expected-results.txt Thu Jun 9 08:53:31 2005 @@ -1 +1 @@ -target/classes/org/apache/maven/it0023/test.txt +target/test.txt Modified: maven/components/trunk/maven-core-it/it0023/goals.txt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/goals.txt?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0023/goals.txt (original) +++ maven/components/trunk/maven-core-it/it0023/goals.txt Thu Jun 9 08:53:31 2005 @@ -1 +1 @@ -package \ No newline at end of file +core-it:touch \ No newline at end of file Modified: maven/components/trunk/maven-core-it/it0023/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/pom.xml?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0023/pom.xml (original) +++ maven/components/trunk/maven-core-it/it0023/pom.xml Thu Jun 9 08:53:31 2005 @@ -4,23 +4,21 @@ <artifactId>maven-it0023</artifactId> <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - </dependency> - </dependencies> - <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> + <artifactId>maven-core-it-plugin</artifactId> + <version>1.0-SNAPSHOT</version> <configuration> - <test>${test}</test> + <pluginItem>${test}</pluginItem> </configuration> </plugin> + <!-- plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-projecthelp-plugin</artifactId> + <version>2.0-alpha-3-SNAPSHOT</version> + </plugin --> </plugins> </build> -</model> \ No newline at end of file +</model> Modified: maven/components/trunk/maven-core-it/it0023/settings.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/settings.xml?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core-it/it0023/settings.xml (original) +++ maven/components/trunk/maven-core-it/it0023/settings.xml Thu Jun 9 08:53:31 2005 @@ -14,7 +14,7 @@ </activation> <properties> - <test>**/SomeAddTest*</test> + <test>test.txt</test> </properties> </profile> </profiles> Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java (original) +++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java Thu Jun 9 08:53:31 2005 @@ -36,6 +36,8 @@ { Profile profile = new Profile(); + profile.setId( settingsProfile.getId() ); + profile.setSource( "settings.xml" ); org.apache.maven.settings.Activation settingsActivation = settingsProfile.getActivation(); @@ -59,8 +61,8 @@ } } - profile.addEvalProperties( settingsProfile.getProperties() ); - + profile.setProperties( settingsProfile.getProperties() ); + List repos = settingsProfile.getRepositories(); if ( repos != null ) { @@ -88,6 +90,8 @@ { Profile profile = new Profile(); + profile.setId( profileXmlProfile.getId() ); + profile.setSource( "profiles.xml" ); org.apache.maven.profiles.Activation profileActivation = profileXmlProfile.getActivation(); @@ -117,7 +121,7 @@ profile.setActivation( new AlwaysOnActivation() ); } - profile.addEvalProperties( profileXmlProfile.getProperties() ); + profile.setProperties( profileXmlProfile.getProperties() ); List repos = profileXmlProfile.getRepositories(); if ( repos != null ) Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java (original) +++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java Thu Jun 9 08:53:31 2005 @@ -135,11 +135,11 @@ // Check properties that have been injected via profiles before we default over to // system properties. - if( context.getProject().getProfileConfiguration() != null ) + if( context.getProject().getProfileProperties() != null ) { - value = context.getProject().getProfileConfiguration().getProperty( expression ); + value = context.getProject().getProfileProperties().getProperty( expression ); } - + if( value == null ) { // We will attempt to get nab a system property as a way to specify a Modified: maven/components/trunk/maven-model/maven.mdo URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-model/maven.mdo (original) +++ maven/components/trunk/maven-model/maven.mdo Thu Jun 9 08:53:31 2005 @@ -664,24 +664,6 @@ </association> </field> </fields> - <codeSegments> - <codeSegment> - <version>4.0.0</version> - <code><![CDATA[ - private Properties evalProperties = new Properties(); - - public void addEvalProperties( Properties properties ) - { - this.evalProperties.putAll( properties ); - } - - public Properties getEvalProperties() - { - return evalProperties; - } - ]]></code> - </codeSegment> - </codeSegments> </class> <!-- @todo: is any of this too CVS specific? Investigate other SCMs --> <class> @@ -2328,6 +2310,7 @@ // We don't want this to be parseable...it's sort of 'hidden' // default source for this profile is in the pom itself. private String source = "pom"; + private Properties properties = new Properties(); public void setSource( String source ) { @@ -2337,6 +2320,21 @@ public String getSource() { return source; + } + + public String toString() + { + return "Profile {id: " + getId() + ", source: " + getSource() + "}"; + } + + public void setProperties( Properties properties ) + { + this.properties = properties; + } + + public Properties getProperties() + { + return properties; } ]]></code> </codeSegment> Modified: maven/components/trunk/maven-model/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/pom.xml?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-model/pom.xml (original) +++ maven/components/trunk/maven-model/pom.xml Thu Jun 9 08:53:31 2005 @@ -20,7 +20,8 @@ <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> - <version>1.0-alpha-3-SNAPSHOT</version> + <version>1.0-alpha-2</version> + <!-- version>1.0-alpha-3-SNAPSHOT</version --> <configuration> <version>4.0.0</version> <model>maven.mdo</model> Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=189768&r1=189767&r2=189768&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 Thu Jun 9 08:53:31 2005 @@ -67,6 +67,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; /** @@ -283,22 +284,27 @@ modelCache.put( key, model ); } - // TODO: Add profiles support here? List activeProfiles = new ArrayList( externalProfiles ); List activePomProfiles = profileActivationCalculator.calculateActiveProfiles( model.getProfiles() ); activeProfiles.addAll( activePomProfiles ); + Properties profileProperties = new Properties(); + for ( Iterator it = activeProfiles.iterator(); it.hasNext(); ) { Profile profile = (Profile) it.next(); modelInheritanceAssembler.mergeProfileWithModel( model, profile ); + + profileProperties.putAll( profile.getProperties() ); } + + // TODO: Clean this up...we're using this to 'jump' the interpolation step for model properties not expressed in XML. model = modelInterpolator.interpolate( model ); - + // interpolation is before injection, because interpolation is off-limits in the injected variables modelDefaultsInjector.injectDefaults( model ); @@ -306,7 +312,9 @@ project = new MavenProject( model ); - project.addActiveProfiles( activePomProfiles ); + project.addProfileProperties( profileProperties ); + + project.setActiveProfiles( activeProfiles ); project.setPluginArtifactRepositories( ProjectUtils.buildArtifactRepositories( model.getPluginRepositories(), artifactRepositoryFactory, container ) ); Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original) +++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Thu Jun 9 08:53:31 2005 @@ -80,7 +80,7 @@ private List remoteArtifactRepositories; - private Properties profileConfiguration; + private Properties profileProperties = new Properties(); private List collectedProjects = Collections.EMPTY_LIST; @@ -891,17 +891,17 @@ return model.getPluginRepositories(); } - public Properties getProfileConfiguration() + public Properties getProfileProperties() { - return profileConfiguration; + return profileProperties; } - public void addProfileConfiguration( Properties profileConfiguration ) + public void addProfileProperties( Properties profileConfiguration ) { - this.profileConfiguration = profileConfiguration; + this.profileProperties.putAll( profileConfiguration ); } - public void addActiveProfiles( List activeProfiles ) + public void setActiveProfiles( List activeProfiles ) { this.activeProfiles.addAll( activeProfiles ); } Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java?rev=189768&r1=189767&r2=189768&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java (original) +++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java Thu Jun 9 08:53:31 2005 @@ -151,7 +151,7 @@ public void mergeProfileWithModel( Model model, Profile profile ) { assembleModelBaseInheritance( model, profile ); - + assembleBuildBaseInheritance( model.getBuild(), profile.getBuild() ); } @@ -221,9 +221,6 @@ } assembleDependencyManagementInheritance( child, parent ); - - // Evaluation Properties :: aggregate - child.addEvalProperties( parent.getEvalProperties() ); } private void assembleDependencyManagementInheritance( ModelBase child, ModelBase parent ) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]