Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<?xml version="1.0"?>
<uberwar>
  ...
  <merges>
    ...
    <merge>
      <type>web.xml</type>
      <parameters>
        <default>
          <tag name="display-name">

           <strategy name="Overwrite"/>
 
        </tag>
 
        <tag name="welcome-file-list">

           <strategy name="NodeMerge">
 
            <welcome-file-list>
 
              <welcome-file>$left:welcome-file</welcome-file>

               <welcome-file>$right:welcome-file</welcome-file>
 
            </welcome-file-list>
 
          </strategy>

         </tag>
 
        <tag name="context-param">
 
          <strategy name="ChooseByName">

             <default>
 
              <strategy name="Preserve"/>
 
            </default>

             <choice name="contextConfigLocation">
 
              <strategy name="NodeMerge">
 
                <context-param>

                   <param-name>$left:param-name</param-name>
 
                  <param-value>$left:param-value,$right:param-value</param-value>
 
                </context-param>

               </strategy>
 
            </choice>
 
          </strategy>

         </tag>
        </default>
      </parameters>
    </merge>
  </merges>
</uberwar>
Warning
Note the <default> element that contains merge strategies by tag and is the only child of <parameters> element.

For each tag in the web.xml, the descriptor is defining how you want the merge to happen (the 'strategy'). There are 4 out-of-the-box strategies, and you can provide your own by passing the name of a class that implements org.codehaus.cargo.module.merge.strategy.MergeStrategy. These strategies define what should happen if an entry is just in one file, or what to do if there is a conflict. When merging, each successive file is merged in sequence - so if there are 3 merges to do, the first two files will be merged together, then the result will be merged with the last file. In each merge operation, the first of the two files is the 'left hand side', and the second of the two files is the 'right hand side' (think of source code merge utilities).

...