brett       2004/12/03 12:51:03

  Modified:    .        Tag: MAVEN-1_0-BRANCH maven.xml project.xml
               src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH
                        MavenUtils.java
               src/test/touchstone-build Tag: MAVEN-1_0-BRANCH maven.xml
               src/test/touchstone-build/src/reactor-build/inheritence Tag:
                        MAVEN-1_0-BRANCH maven.xml project.properties
                        project.xml
               
src/test/touchstone-build/src/reactor-build/inheritence/subproject
                        Tag: MAVEN-1_0-BRANCH maven.xml project.xml
               
src/test/touchstone-build/src/reactor-build/inheritence/subproject/subproject2
                        Tag: MAVEN-1_0-BRANCH maven.xml project.xml
               xdocs    Tag: MAVEN-1_0-BRANCH changes.xml
  Log:
  PR: MAVEN-1501
  fix property inheritance for builtin properties such as maven.repo.remote
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.97.2.35 +4 -1      maven/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven/maven.xml,v
  retrieving revision 1.97.2.34
  retrieving revision 1.97.2.35
  diff -u -r1.97.2.34 -r1.97.2.35
  --- maven.xml 6 Nov 2004 02:24:28 -0000       1.97.2.34
  +++ maven.xml 3 Dec 2004 20:50:55 -0000       1.97.2.35
  @@ -95,10 +95,13 @@
       name="maven:plugins-test"
       description="Test each Maven plugin">
   
  +    <!-- Exclude broken plugin tests (some only broken inside the reactor -->
  +    <j:set var="excludes" 
value="${maven.plugins.excludes},dashboard/**,dist/**,ear/**,hibernate/**,pdf/**"/>
  +
       <maven:reactor
         basedir="${maven.plugins.directory}"
         includes="${maven.plugins.includes}"
  -      excludes="${maven.plugins.excludes}"
  +      excludes="${excludes}"
         goals="plugin:test"
         banner="Testing"
         ignoreFailures="false"
  
  
  
  1.317.4.40 +1 -1      maven/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven/project.xml,v
  retrieving revision 1.317.4.39
  retrieving revision 1.317.4.40
  diff -u -r1.317.4.39 -r1.317.4.40
  --- project.xml       10 Nov 2004 11:26:04 -0000      1.317.4.39
  +++ project.xml       3 Dec 2004 20:50:55 -0000       1.317.4.40
  @@ -22,7 +22,7 @@
     <pomVersion>3</pomVersion>
     <id>maven</id>
     <name>Maven</name>
  -  <currentVersion>1.0.1</currentVersion>
  +  <currentVersion>1.0.2-SNAPSHOT</currentVersion>
     <organization>
       <name>Apache Software Foundation</name>
       <url>http://www.apache.org/</url>
  
  
  
  No                   revision
  No                   revision
  1.107.4.29 +43 -31    maven/src/java/org/apache/maven/MavenUtils.java
  
  Index: MavenUtils.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/MavenUtils.java,v
  retrieving revision 1.107.4.28
  retrieving revision 1.107.4.29
  diff -u -r1.107.4.28 -r1.107.4.29
  --- MavenUtils.java   6 Nov 2004 07:27:11 -0000       1.107.4.28
  +++ MavenUtils.java   3 Dec 2004 20:50:55 -0000       1.107.4.29
  @@ -208,7 +208,7 @@
           }
   
           // 2)
  -        MavenJellyContext context = MavenUtils.createContext( 
projectDescriptor.getParentFile(), parentContext );
  +        MavenJellyContext context = MavenUtils.createContextNoDefaults( 
projectDescriptor.getParentFile(), parentContext );
   
           // 3)
           String pomToExtend = project.getExtend();
  @@ -252,6 +252,9 @@
               project.mergeParent( parent );
           }
   
  +// TODO: check defaults are also applied to project.xml correctly
  +        applyDefaults( context );
  +
           // Set the created context, and put the project itself in the 
context. This
           // is how we get the ${pom} reference in the project.xml file to 
work.
           project.setContext( context );
  @@ -724,6 +727,25 @@
       public static MavenJellyContext createContext( File descriptorDirectory, 
                                                      MavenJellyContext 
parentContext )
       {
  +        MavenJellyContext context = createContextNoDefaults( 
descriptorDirectory, parentContext );
  +        applyDefaults( context );
  +        return context;
  +    }
  +
  +    /**
  +     * Create a jelly context given a descriptor directory and parent
  +     * jelly context, but don't apply any defaults.
  +     *
  +     * @param descriptorDirectory The directory from which to pull the 
standard maven
  +     * properties files from.
  +     * @param parentContext The parent jelly context.
  +     * @todo should premerge driver, etc if they are being kept
  +     * @return The generated maven based on the contents of the standard 
maven
  +     * properties files.
  +     */
  +    private static MavenJellyContext createContextNoDefaults( File 
descriptorDirectory, 
  +                                                              
MavenJellyContext parentContext )
  +    {
           // System properties
           Properties systemProperties = System.getProperties();
   
  @@ -741,10 +763,6 @@
               MavenUtils.class.getResourceAsStream(
                   MavenConstants.DRIVER_PROPERTIES ) );
   
  -        Properties defaultProperties = loadProperties(
  -            MavenUtils.class.getResourceAsStream(
  -                MavenConstants.DEFAULTS_PROPERTIES ) );
  -
           Map result = MavenUtils.mergeMaps( new Map[]
           {
               systemProperties,
  @@ -756,47 +774,41 @@
   
           MavenJellyContext context;
   
  -        // If we have a parent we eventually want what values it can provide 
but
  -        // we turn inheritance off momentarily until we finish integrating 
the
  -        // child's context values into the jelly context because we want the
  -        // child values to win and only use the parent in the event the
  -        // child cannot provide the value.
  -
           if ( parentContext != null )
           {
               context = new MavenJellyContext( parentContext );
  -            context.setInherit( false );
  -
  -            MavenUtils.integrateMapInContext( result, context );
  -
  -            // Turn inheritance back on to make the parent's values visible.
  -            context.setInherit( true );
  -
  -            //add in the default.properties with defaults, but in 
inheritance mode.
  -            MavenUtils.integrateMapInContext( defaultProperties, context );
           }
           else
           {
               context = new MavenJellyContext();
  +        }
   
  -            //integrate everything else...
  -            MavenUtils.integrateMapInContext( result, context );
  -
  -            //integrate defaults...
  -            MavenUtils.integrateMapInContext( defaultProperties, context );
  +        // Turn off inheritence so parent values are overriden
  +        context.setInherit( false );
   
  -            // Turn inheritance back on to make the parent's values visible.
  -            context.setInherit( true );
  -        }
  +        //integrate everything else...
  +        MavenUtils.integrateMapInContext( result, context );
   
  +        // Turn inheritance back on to make the parent's values visible.
  +        context.setInherit( true );
   
           // Set the basedir value in the context.
           context.setVariable( "basedir", 
descriptorDirectory.getAbsolutePath() );
   
  +        return context;
  +    }
  +
  +    private static void applyDefaults( MavenJellyContext context )
  +    {
  +        Properties defaultProperties = loadProperties(
  +            MavenUtils.class.getResourceAsStream(
  +                MavenConstants.DEFAULTS_PROPERTIES ) );
  +
  +        //integrate defaults...
  +        MavenUtils.integrateMapInContext( defaultProperties, context );
  +
           // deliberately use the original base directory for these variables
           context.resolveRelativePaths( new File( System.getProperty( 
"user.dir" ) ) );
  -
  -        return context;
       }
   
       /**
  
  
  
  No                   revision
  No                   revision
  1.43.4.23 +6 -0      maven/src/test/touchstone-build/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven/src/test/touchstone-build/maven.xml,v
  retrieving revision 1.43.4.22
  retrieving revision 1.43.4.23
  diff -u -r1.43.4.22 -r1.43.4.23
  --- maven.xml 24 Oct 2004 02:07:31 -0000      1.43.4.22
  +++ maven.xml 3 Dec 2004 20:50:57 -0000       1.43.4.23
  @@ -774,6 +774,12 @@
     </goal>
   
     <goal name="test-inheritance">
  +    <ant:echo>Testing 0 level</ant:echo>
  +    <maven:maven
  +      descriptor="${basedir}/src/reactor-build/inheritence/project.xml"
  +      goals="runTest"
  +      ignoreFailures="false"
  +    />
       <ant:echo>Testing 1 level</ant:echo>
       <maven:maven
         
descriptor="${basedir}/src/reactor-build/inheritence/subproject/project.xml"
  
  
  
  No                   revision
  No                   revision
  1.1.4.4   +21 -1     
maven/src/test/touchstone-build/src/reactor-build/inheritence/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/maven.xml,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- maven.xml 24 Apr 2004 23:11:23 -0000      1.1.4.3
  +++ maven.xml 3 Dec 2004 20:50:59 -0000       1.1.4.4
  @@ -17,7 +17,27 @@
    */
    -->
   
  -<project xmlns:j="jelly:core" xmlns:ant="jelly:ant">
  +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="runTest">
  +
  +    <goal name="runTest">
  +      <ant:echo>overridden builtin property POM substitution</ant:echo>
  +      <j:set var="value" value="${pom.url}"/>
  +      <j:if test="${value != 'dummy'}">
  +        <ant:fail>Sorry, but pom.url = '${value}', inherited 
incorrectly</ant:fail>
  +      </j:if>
  +      <ant:echo>default builtin property substitution</ant:echo>
  +      <j:set var="value" value="${maven.build.dir}"/>
  +      <j:set var="targetDir" value="${basedir}/target"/>
  +      <j:if test="${value != targetDir}">
  +        <ant:fail>Sorry, but maven.build.dir = '${value}', incorrectly 
set</ant:fail>
  +      </j:if>
  +      <ant:echo>default builtin property POM substitution</ant:echo>
  +      <j:set var="value" value="${pom.description}"/>
  +      <j:set var="targetDir" value="${basedir}/target"/>
  +      <j:if test="${value != targetDir}">
  +        <ant:fail>Sorry, but pom.description = '${value}', incorrectly 
set</ant:fail>
  +      </j:if>
  +    </goal>
   
       <goal name="parent-goal">
         <ant:property name="parentVar" value="parentVar" />
  
  
  
  1.1.4.3   +2 -0      
maven/src/test/touchstone-build/src/reactor-build/inheritence/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/project.properties,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- project.properties        4 Mar 2004 17:47:01 -0000       1.1.4.2
  +++ project.properties        3 Dec 2004 20:50:59 -0000       1.1.4.3
  @@ -16,3 +16,5 @@
   
   parent.project.property=okiedokie
   parent.project.property.override=original
  +
  +maven.repo.remote=dummy
  
  
  
  1.1.4.3   +25 -24    
maven/src/test/touchstone-build/src/reactor-build/inheritence/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/project.xml,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- project.xml       4 Mar 2004 17:47:01 -0000       1.1.4.2
  +++ project.xml       3 Dec 2004 20:51:01 -0000       1.1.4.3
  @@ -16,27 +16,28 @@
    * limitations under the License.
    */
    -->
  -

  -<project>

  -  <pomVersion>3</pomVersion>

  -  <currentVersion>1.0</currentVersion>

  -  <name>root</name>

  -  <organization/>

  -  <inceptionYear/>

  -  <package/>

  -  <logo/>

  -  <shortDescription/>

  -  <url/>

  -  <siteAddress/>

  -  <siteDirectory/>

  -  <distributionSite/>

  -  <distributionDirectory/>

  -  <repository/>

  -  <mailingLists/>

  -  <developers/>

  -  <dependencies/>

  -  <build>

  -    <sourceDirectory/>

  -    <unitTestSourceDirectory/>

  -  </build>

  -</project>

  +
  +<project>
  +  <pomVersion>3</pomVersion>
  +  <currentVersion>1.0</currentVersion>
  +  <name>root</name>
  +  <organization/>
  +  <inceptionYear/>
  +  <package/>
  +  <logo/>
  +  <shortDescription/>
  +  <description>${maven.build.dir}</description>
  +  <url>${maven.repo.remote}</url>
  +  <siteAddress/>
  +  <siteDirectory/>
  +  <distributionSite/>
  +  <distributionDirectory/>
  +  <repository/>
  +  <mailingLists/>
  +  <developers/>
  +  <dependencies/>
  +  <build>
  +    <sourceDirectory/>
  +    <unitTestSourceDirectory/>
  +  </build>
  +</project>
  
  
  
  No                   revision
  No                   revision
  1.1.4.4   +10 -0     
maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/maven.xml,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- maven.xml 24 Apr 2004 23:11:23 -0000      1.1.4.3
  +++ maven.xml 3 Dec 2004 20:51:02 -0000       1.1.4.4
  @@ -50,6 +50,16 @@
         <j:if test="${value != 'overridden'}">
           <ant:fail>Sorry, but parent.build.property.override = '${value}', 
inherited incorrectly</ant:fail>
         </j:if>
  +      <ant:echo>inherited builtin property override test</ant:echo>
  +      <j:set var="value" value="${maven.repo.remote}"/>
  +      <j:if test="${value != 'dummy'}">
  +        <ant:fail>Sorry, but maven.repo.remote = '${value}', inherited 
incorrectly</ant:fail>
  +      </j:if>
  +      <ant:echo>inherited builtin property POM substitution</ant:echo>
  +      <j:set var="value" value="${pom.url}"/>
  +      <j:if test="${value != 'dummy'}">
  +        <ant:fail>Sorry, but pom.url = '${value}', inherited 
incorrectly</ant:fail>
  +      </j:if>
       </goal>
   
       <goal name="parent-goal-override-1">
  
  
  
  1.1.4.3   +24 -25    
maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/project.xml,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- project.xml       4 Mar 2004 17:47:01 -0000       1.1.4.2
  +++ project.xml       3 Dec 2004 20:51:02 -0000       1.1.4.3
  @@ -16,28 +16,27 @@
    * limitations under the License.
    */
    -->
  -

  -<project>

  -  <extend>../project.xml</extend>

  -  <pomVersion>3</pomVersion>

  -  <currentVersion>1.0</currentVersion>

  -  <name>subproject</name>

  -  <organization/>

  -  <inceptionYear/>

  -  <package/>

  -  <logo/>

  -  <shortDescription/>

  -  <url/>

  -  <siteAddress/>

  -  <siteDirectory/>

  -  <distributionSite/>

  -  <distributionDirectory/>

  -  <repository/>

  -  <mailingLists/>

  -  <developers/>

  -  <dependencies/>

  -  <build>

  -    <sourceDirectory/>

  -    <unitTestSourceDirectory/>

  -  </build>

  -</project>

  +
  +<project>
  +  <extend>../project.xml</extend>
  +  <pomVersion>3</pomVersion>
  +  <currentVersion>1.0</currentVersion>
  +  <name>subproject</name>
  +  <organization/>
  +  <inceptionYear/>
  +  <package/>
  +  <logo/>
  +  <shortDescription/>
  +  <siteAddress/>
  +  <siteDirectory/>
  +  <distributionSite/>
  +  <distributionDirectory/>
  +  <repository/>
  +  <mailingLists/>
  +  <developers/>
  +  <dependencies/>
  +  <build>
  +    <sourceDirectory/>
  +    <unitTestSourceDirectory/>
  +  </build>
  +</project>
  
  
  
  No                   revision
  No                   revision
  1.1.4.4   +10 -0     
maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/subproject2/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/subproject2/maven.xml,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- maven.xml 24 Apr 2004 23:11:23 -0000      1.1.4.3
  +++ maven.xml 3 Dec 2004 20:51:02 -0000       1.1.4.4
  @@ -62,6 +62,16 @@
         <j:if test="${value != 'overridden2'}">
           <ant:fail>Sorry, but parent.build.property.override = '${value}', 
inherited incorrectly in 2nd subproject</ant:fail>
         </j:if>
  +      <ant:echo>inherited builtin property override test</ant:echo>
  +      <j:set var="value" value="${maven.repo.remote}"/>
  +      <j:if test="${value != 'dummy'}">
  +        <ant:fail>Sorry, but maven.repo.remote = '${value}', inherited 
incorrectly</ant:fail>
  +      </j:if>
  +      <ant:echo>inherited builtin property POM substitution</ant:echo>
  +      <j:set var="value" value="${pom.url}"/>
  +      <j:if test="${value != 'dummy'}">
  +        <ant:fail>Sorry, but pom.url = '${value}', inherited 
incorrectly</ant:fail>
  +      </j:if>
       </goal>
   
       <goal name="parent-goal-override-2">
  
  
  
  1.1.4.3   +24 -25    
maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/subproject2/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: 
/home/cvs/maven/src/test/touchstone-build/src/reactor-build/inheritence/subproject/subproject2/project.xml,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- project.xml       4 Mar 2004 17:47:01 -0000       1.1.4.2
  +++ project.xml       3 Dec 2004 20:51:02 -0000       1.1.4.3
  @@ -16,28 +16,27 @@
    * limitations under the License.
    */
    -->
  -

  -<project>

  -  <extend>../project.xml</extend>

  -  <pomVersion>3</pomVersion>

  -  <currentVersion>1.0</currentVersion>

  -  <name>subproject</name>

  -  <organization/>

  -  <inceptionYear/>

  -  <package/>

  -  <logo/>

  -  <shortDescription/>

  -  <url/>

  -  <siteAddress/>

  -  <siteDirectory/>

  -  <distributionSite/>

  -  <distributionDirectory/>

  -  <repository/>

  -  <mailingLists/>

  -  <developers/>

  -  <dependencies/>

  -  <build>

  -    <sourceDirectory/>

  -    <unitTestSourceDirectory/>

  -  </build>

  -</project>

  +
  +<project>
  +  <extend>../project.xml</extend>
  +  <pomVersion>3</pomVersion>
  +  <currentVersion>1.0</currentVersion>
  +  <name>subproject</name>
  +  <organization/>
  +  <inceptionYear/>
  +  <package/>
  +  <logo/>
  +  <shortDescription/>
  +  <siteAddress/>
  +  <siteDirectory/>
  +  <distributionSite/>
  +  <distributionDirectory/>
  +  <repository/>
  +  <mailingLists/>
  +  <developers/>
  +  <dependencies/>
  +  <build>
  +    <sourceDirectory/>
  +    <unitTestSourceDirectory/>
  +  </build>
  +</project>
  
  
  
  No                   revision
  No                   revision
  1.14.4.52 +4 -0      maven/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven/xdocs/changes.xml,v
  retrieving revision 1.14.4.51
  retrieving revision 1.14.4.52
  diff -u -r1.14.4.51 -r1.14.4.52
  --- changes.xml       10 Nov 2004 11:26:04 -0000      1.14.4.51
  +++ changes.xml       3 Dec 2004 20:51:03 -0000       1.14.4.52
  @@ -24,6 +24,10 @@
       <author email="[EMAIL PROTECTED]">Vincent Massol</author>
     </properties>
     <body>
  +    <release version="1.0.2" date="in CVS">
  +      <action dev="brett" type="fix" issue="MAVEN-1501">Ensure that default 
properties are correctly overidden when inherited from a parent</action>
  +    </release>
  +
       <release version="1.0.1" date="2004-11-10">
         <action dev="brett" type="fix">Ensure plugin:install correctly 
refreshes the cache when the plugin with the same version was previously 
installed</action>
         <action dev="brett" type="fix" issue="MAVEN-1471">Move dependency 
verification until the point where the project is in a consistent state, so 
that the reactor succeeds when ignoreFailures is true</action>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to