View Javadoc

1   package org.apache.maven.model.merge;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.ArrayList;
23  import java.util.HashMap;
24  import java.util.LinkedHashMap;
25  import java.util.List;
26  import java.util.Map;
27  import java.util.Properties;
28  
29  import org.apache.maven.model.Activation;
30  import org.apache.maven.model.Build;
31  import org.apache.maven.model.BuildBase;
32  import org.apache.maven.model.CiManagement;
33  import org.apache.maven.model.ConfigurationContainer;
34  import org.apache.maven.model.Contributor;
35  import org.apache.maven.model.Dependency;
36  import org.apache.maven.model.DependencyManagement;
37  import org.apache.maven.model.DeploymentRepository;
38  import org.apache.maven.model.Developer;
39  import org.apache.maven.model.DistributionManagement;
40  import org.apache.maven.model.Exclusion;
41  import org.apache.maven.model.Extension;
42  import org.apache.maven.model.FileSet;
43  import org.apache.maven.model.InputLocation;
44  import org.apache.maven.model.IssueManagement;
45  import org.apache.maven.model.License;
46  import org.apache.maven.model.MailingList;
47  import org.apache.maven.model.Model;
48  import org.apache.maven.model.ModelBase;
49  import org.apache.maven.model.Notifier;
50  import org.apache.maven.model.Organization;
51  import org.apache.maven.model.Parent;
52  import org.apache.maven.model.PatternSet;
53  import org.apache.maven.model.Plugin;
54  import org.apache.maven.model.PluginConfiguration;
55  import org.apache.maven.model.PluginContainer;
56  import org.apache.maven.model.PluginExecution;
57  import org.apache.maven.model.PluginManagement;
58  import org.apache.maven.model.Prerequisites;
59  import org.apache.maven.model.Profile;
60  import org.apache.maven.model.Relocation;
61  import org.apache.maven.model.ReportPlugin;
62  import org.apache.maven.model.ReportSet;
63  import org.apache.maven.model.Reporting;
64  import org.apache.maven.model.Repository;
65  import org.apache.maven.model.RepositoryBase;
66  import org.apache.maven.model.RepositoryPolicy;
67  import org.apache.maven.model.Resource;
68  import org.apache.maven.model.Scm;
69  import org.apache.maven.model.Site;
70  import org.codehaus.plexus.util.xml.Xpp3Dom;
71  
72  /**
73   * This is a hand-crafted prototype of the default model merger that should eventually be generated by Modello by a new
74   * Java plugin.
75   *
76   * @author Benjamin Bentmann
77   */
78  public class ModelMerger
79  {
80  
81      /**
82       * Merges the specified source object into the given target object.
83       *
84       * @param target The target object whose existing contents should be merged with the source, must not be
85       *            <code>null</code>.
86       * @param source The (read-only) source object that should be merged into the target object, may be
87       *            <code>null</code>.
88       * @param sourceDominant A flag indicating whether either the target object or the source object provides the
89       *            dominant data.
90       * @param hints A set of key-value pairs that customized merger implementations can use to carry domain-specific
91       *            information along, may be <code>null</code>.
92       */
93      public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints )
94      {
95          if ( target == null )
96          {
97              throw new IllegalArgumentException( "target missing" );
98          }
99  
100         if ( source == null )
101         {
102             return;
103         }
104 
105         Map<Object, Object> context = new HashMap<Object, Object>();
106         if ( hints != null )
107         {
108             context.putAll( hints );
109         }
110 
111         mergeModel( target, source, sourceDominant, context );
112     }
113 
114     protected void mergeModel( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
115     {
116         mergeModelBase( target, source, sourceDominant, context );
117 
118         mergeModel_ModelVersion( target, source, sourceDominant, context );
119         mergeModel_Parent( target, source, sourceDominant, context );
120         mergeModel_GroupId( target, source, sourceDominant, context );
121         mergeModel_ArtifactId( target, source, sourceDominant, context );
122         mergeModel_Version( target, source, sourceDominant, context );
123         mergeModel_Packaging( target, source, sourceDominant, context );
124         mergeModel_Name( target, source, sourceDominant, context );
125         mergeModel_Description( target, source, sourceDominant, context );
126         mergeModel_Url( target, source, sourceDominant, context );
127         mergeModel_InceptionYear( target, source, sourceDominant, context );
128         mergeModel_Organization( target, source, sourceDominant, context );
129         mergeModel_Licenses( target, source, sourceDominant, context );
130         mergeModel_MailingLists( target, source, sourceDominant, context );
131         mergeModel_Developers( target, source, sourceDominant, context );
132         mergeModel_Contributors( target, source, sourceDominant, context );
133         mergeModel_IssueManagement( target, source, sourceDominant, context );
134         mergeModel_Scm( target, source, sourceDominant, context );
135         mergeModel_CiManagement( target, source, sourceDominant, context );
136         mergeModel_Prerequisites( target, source, sourceDominant, context );
137         mergeModel_Build( target, source, sourceDominant, context );
138         mergeModel_Profiles( target, source, sourceDominant, context );
139     }
140 
141     protected void mergeModel_ModelVersion( Model target, Model source, boolean sourceDominant,
142                                             Map<Object, Object> context )
143     {
144         String src = source.getModelVersion();
145         if ( src != null )
146         {
147             if ( sourceDominant || target.getModelVersion() == null )
148             {
149                 target.setModelVersion( src );
150                 target.setLocation( "modelVersion", source.getLocation( "modelVersion" ) );
151             }
152         }
153     }
154 
155     protected void mergeModel_Parent( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
156     {
157         Parent src = source.getParent();
158         if ( src != null )
159         {
160             Parent tgt = target.getParent();
161             if ( tgt == null )
162             {
163                 tgt = new Parent();
164                 tgt.setRelativePath( null );
165                 target.setParent( tgt );
166             }
167             mergeParent( tgt, src, sourceDominant, context );
168         }
169     }
170 
171     protected void mergeModel_GroupId( Model target, Model source, boolean sourceDominant,
172                                        Map<Object, Object> context )
173     {
174         String src = source.getGroupId();
175         if ( src != null )
176         {
177             if ( sourceDominant || target.getGroupId() == null )
178             {
179                 target.setGroupId( src );
180                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
181             }
182         }
183     }
184 
185     protected void mergeModel_ArtifactId( Model target, Model source, boolean sourceDominant,
186                                           Map<Object, Object> context )
187     {
188         String src = source.getArtifactId();
189         if ( src != null )
190         {
191             if ( sourceDominant || target.getArtifactId() == null )
192             {
193                 target.setArtifactId( src );
194                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
195             }
196         }
197     }
198 
199     protected void mergeModel_Version( Model target, Model source, boolean sourceDominant,
200                                        Map<Object, Object> context )
201     {
202         String src = source.getVersion();
203         if ( src != null )
204         {
205             if ( sourceDominant || target.getVersion() == null )
206             {
207                 target.setVersion( src );
208                 target.setLocation( "version", source.getLocation( "version" ) );
209             }
210         }
211     }
212 
213     protected void mergeModel_Packaging( Model target, Model source, boolean sourceDominant,
214                                          Map<Object, Object> context )
215     {
216         String src = source.getPackaging();
217         if ( src != null )
218         {
219             if ( sourceDominant || target.getPackaging() == null )
220             {
221                 target.setPackaging( src );
222                 target.setLocation( "packaging", source.getLocation( "packaging" ) );
223             }
224         }
225     }
226 
227     protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
228     {
229         String src = source.getName();
230         if ( src != null )
231         {
232             if ( sourceDominant || target.getName() == null )
233             {
234                 target.setName( src );
235                 target.setLocation( "name", source.getLocation( "name" ) );
236             }
237         }
238     }
239 
240     protected void mergeModel_Description( Model target, Model source, boolean sourceDominant,
241                                            Map<Object, Object> context )
242     {
243         String src = source.getDescription();
244         if ( src != null )
245         {
246             if ( sourceDominant || target.getDescription() == null )
247             {
248                 target.setDescription( src );
249                 target.setLocation( "description", source.getLocation( "description" ) );
250             }
251         }
252     }
253 
254     protected void mergeModel_Url( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
255     {
256         String src = source.getUrl();
257         if ( src != null )
258         {
259             if ( sourceDominant || target.getUrl() == null )
260             {
261                 target.setUrl( src );
262                 target.setLocation( "url", source.getLocation( "url" ) );
263             }
264         }
265     }
266 
267     protected void mergeModel_InceptionYear( Model target, Model source, boolean sourceDominant,
268                                              Map<Object, Object> context )
269     {
270         String src = source.getInceptionYear();
271         if ( src != null )
272         {
273             if ( sourceDominant || target.getInceptionYear() == null )
274             {
275                 target.setInceptionYear( src );
276                 target.setLocation( "inceptionYear", source.getLocation( "inceptionYear" ) );
277             }
278         }
279     }
280 
281     protected void mergeModel_Organization( Model target, Model source, boolean sourceDominant,
282                                             Map<Object, Object> context )
283     {
284         Organization src = source.getOrganization();
285         if ( src != null )
286         {
287             Organization tgt = target.getOrganization();
288             if ( tgt == null )
289             {
290                 tgt = new Organization();
291                 target.setOrganization( tgt );
292             }
293             mergeOrganization( tgt, src, sourceDominant, context );
294         }
295     }
296 
297     protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant,
298                                         Map<Object, Object> context )
299     {
300         List<License> src = source.getLicenses();
301         if ( !src.isEmpty() )
302         {
303             List<License> tgt = target.getLicenses();
304             Map<Object, License> merged = new LinkedHashMap<Object, License>( ( src.size() + tgt.size() ) * 2 );
305 
306             for ( License element : tgt )
307             {
308                 Object key = getLicenseKey( element );
309                 merged.put( key, element );
310             }
311 
312             for ( License element : src )
313             {
314                 Object key = getLicenseKey( element );
315                 if ( sourceDominant || !merged.containsKey( key ) )
316                 {
317                     merged.put( key, element );
318                 }
319             }
320 
321             target.setLicenses( new ArrayList<License>( merged.values() ) );
322         }
323     }
324 
325     protected void mergeModel_MailingLists( Model target, Model source, boolean sourceDominant,
326                                             Map<Object, Object> context )
327     {
328         List<MailingList> src = source.getMailingLists();
329         if ( !src.isEmpty() )
330         {
331             List<MailingList> tgt = target.getMailingLists();
332             Map<Object, MailingList> merged = new LinkedHashMap<Object, MailingList>( ( src.size() + tgt.size() ) * 2 );
333 
334             for ( MailingList element : tgt )
335             {
336                 Object key = getMailingListKey( element );
337                 merged.put( key, element );
338             }
339 
340             for ( MailingList element : src )
341             {
342                 Object key = getMailingListKey( element );
343                 if ( sourceDominant || !merged.containsKey( key ) )
344                 {
345                     merged.put( key, element );
346                 }
347             }
348 
349             target.setMailingLists( new ArrayList<MailingList>( merged.values() ) );
350         }
351     }
352 
353     protected void mergeModel_Developers( Model target, Model source, boolean sourceDominant,
354                                           Map<Object, Object> context )
355     {
356         List<Developer> src = source.getDevelopers();
357         if ( !src.isEmpty() )
358         {
359             List<Developer> tgt = target.getDevelopers();
360             Map<Object, Developer> merged = new LinkedHashMap<Object, Developer>( ( src.size() + tgt.size() ) * 2 );
361 
362             for ( Developer element : tgt )
363             {
364                 Object key = getDeveloperKey( element );
365                 merged.put( key, element );
366             }
367 
368             for ( Developer element : src )
369             {
370                 Object key = getDeveloperKey( element );
371                 if ( sourceDominant || !merged.containsKey( key ) )
372                 {
373                     merged.put( key, element );
374                 }
375             }
376 
377             target.setDevelopers( new ArrayList<Developer>( merged.values() ) );
378         }
379     }
380 
381     protected void mergeModel_Contributors( Model target, Model source, boolean sourceDominant,
382                                             Map<Object, Object> context )
383     {
384         List<Contributor> src = source.getContributors();
385         if ( !src.isEmpty() )
386         {
387             List<Contributor> tgt = target.getContributors();
388             Map<Object, Contributor> merged = new LinkedHashMap<Object, Contributor>( ( src.size() + tgt.size() ) * 2 );
389 
390             for ( Contributor element : tgt )
391             {
392                 Object key = getContributorKey( element );
393                 merged.put( key, element );
394             }
395 
396             for ( Contributor element : src )
397             {
398                 Object key = getContributorKey( element );
399                 if ( sourceDominant || !merged.containsKey( key ) )
400                 {
401                     merged.put( key, element );
402                 }
403             }
404 
405             target.setContributors( new ArrayList<Contributor>( merged.values() ) );
406         }
407     }
408 
409     protected void mergeModel_IssueManagement( Model target, Model source, boolean sourceDominant,
410                                                Map<Object, Object> context )
411     {
412         IssueManagement src = source.getIssueManagement();
413         if ( src != null )
414         {
415             IssueManagement tgt = target.getIssueManagement();
416             if ( tgt == null )
417             {
418                 tgt = new IssueManagement();
419                 target.setIssueManagement( tgt );
420             }
421             mergeIssueManagement( tgt, src, sourceDominant, context );
422         }
423     }
424 
425     protected void mergeModel_Scm( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
426     {
427         Scm src = source.getScm();
428         if ( src != null )
429         {
430             Scm tgt = target.getScm();
431             if ( tgt == null )
432             {
433                 tgt = new Scm();
434                 tgt.setTag( null );
435                 target.setScm( tgt );
436             }
437             mergeScm( tgt, src, sourceDominant, context );
438         }
439     }
440 
441     protected void mergeModel_CiManagement( Model target, Model source, boolean sourceDominant,
442                                             Map<Object, Object> context )
443     {
444         CiManagement src = source.getCiManagement();
445         if ( src != null )
446         {
447             CiManagement tgt = target.getCiManagement();
448             if ( tgt == null )
449             {
450                 tgt = new CiManagement();
451                 target.setCiManagement( tgt );
452             }
453             mergeCiManagement( tgt, src, sourceDominant, context );
454         }
455     }
456 
457     protected void mergeModel_Prerequisites( Model target, Model source, boolean sourceDominant,
458                                              Map<Object, Object> context )
459     {
460         Prerequisites src = source.getPrerequisites();
461         if ( src != null )
462         {
463             Prerequisites tgt = target.getPrerequisites();
464             if ( tgt == null )
465             {
466                 tgt = new Prerequisites();
467                 tgt.setMaven( null );
468                 target.setPrerequisites( tgt );
469             }
470             mergePrerequisites( tgt, src, sourceDominant, context );
471         }
472     }
473 
474     protected void mergeModel_Build( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
475     {
476         Build src = source.getBuild();
477         if ( src != null )
478         {
479             Build tgt = target.getBuild();
480             if ( tgt == null )
481             {
482                 tgt = new Build();
483                 target.setBuild( tgt );
484             }
485             mergeBuild( tgt, src, sourceDominant, context );
486         }
487     }
488 
489     protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant,
490                                         Map<Object, Object> context )
491     {
492         List<Profile> src = source.getProfiles();
493         if ( !src.isEmpty() )
494         {
495             List<Profile> tgt = target.getProfiles();
496             Map<Object, Profile> merged = new LinkedHashMap<Object, Profile>( ( src.size() + tgt.size() ) * 2 );
497 
498             for ( Profile element : tgt )
499             {
500                 Object key = getProfileKey( element );
501                 merged.put( key, element );
502             }
503 
504             for ( Profile element : src )
505             {
506                 Object key = getProfileKey( element );
507                 if ( sourceDominant || !merged.containsKey( key ) )
508                 {
509                     merged.put( key, element );
510                 }
511             }
512 
513             target.setProfiles( new ArrayList<Profile>( merged.values() ) );
514         }
515     }
516 
517     protected void mergeModelBase( ModelBase target, ModelBase source, boolean sourceDominant,
518                                    Map<Object, Object> context )
519     {
520         mergeModelBase_DistributionManagement( target, source, sourceDominant, context );
521         mergeModelBase_Modules( target, source, sourceDominant, context );
522         mergeModelBase_Repositories( target, source, sourceDominant, context );
523         mergeModelBase_PluginRepositories( target, source, sourceDominant, context );
524         mergeModelBase_Dependencies( target, source, sourceDominant, context );
525         mergeModelBase_Reporting( target, source, sourceDominant, context );
526         mergeModelBase_DependencyManagement( target, source, sourceDominant, context );
527         mergeModelBase_Properties( target, source, sourceDominant, context );
528     }
529 
530     protected void mergeModelBase_Modules( ModelBase target, ModelBase source, boolean sourceDominant,
531                                            Map<Object, Object> context )
532     {
533         List<String> src = source.getModules();
534         if ( !src.isEmpty() )
535         {
536             List<String> tgt = target.getModules();
537             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
538             merged.addAll( tgt );
539             merged.addAll( src );
540             target.setModules( merged );
541         }
542     }
543 
544     protected void mergeModelBase_Dependencies( ModelBase target, ModelBase source, boolean sourceDominant,
545                                                 Map<Object, Object> context )
546     {
547         List<Dependency> src = source.getDependencies();
548         if ( !src.isEmpty() )
549         {
550             List<Dependency> tgt = target.getDependencies();
551             Map<Object, Dependency> merged = new LinkedHashMap<Object, Dependency>( ( src.size() + tgt.size() ) * 2 );
552 
553             for ( Dependency element : tgt )
554             {
555                 Object key = getDependencyKey( element );
556                 merged.put( key, element );
557             }
558 
559             for ( Dependency element : src )
560             {
561                 Object key = getDependencyKey( element );
562                 if ( sourceDominant || !merged.containsKey( key ) )
563                 {
564                     merged.put( key, element );
565                 }
566             }
567 
568             target.setDependencies( new ArrayList<Dependency>( merged.values() ) );
569         }
570     }
571 
572     protected void mergeModelBase_Repositories( ModelBase target, ModelBase source, boolean sourceDominant,
573                                                 Map<Object, Object> context )
574     {
575         List<Repository> src = source.getRepositories();
576         if ( !src.isEmpty() )
577         {
578             List<Repository> tgt = target.getRepositories();
579             Map<Object, Repository> merged = new LinkedHashMap<Object, Repository>( ( src.size() + tgt.size() ) * 2 );
580 
581             for ( Repository element : tgt )
582             {
583                 Object key = getRepositoryKey( element );
584                 merged.put( key, element );
585             }
586 
587             for ( Repository element : src )
588             {
589                 Object key = getRepositoryKey( element );
590                 if ( sourceDominant || !merged.containsKey( key ) )
591                 {
592                     merged.put( key, element );
593                 }
594             }
595 
596             target.setRepositories( new ArrayList<Repository>( merged.values() ) );
597         }
598     }
599 
600     protected void mergeModelBase_PluginRepositories( ModelBase target, ModelBase source, boolean sourceDominant,
601                                                       Map<Object, Object> context )
602     {
603         List<Repository> src = source.getPluginRepositories();
604         if ( !src.isEmpty() )
605         {
606             List<Repository> tgt = target.getPluginRepositories();
607             Map<Object, Repository> merged = new LinkedHashMap<Object, Repository>( ( src.size() + tgt.size() ) * 2 );
608 
609             for ( Repository element : tgt )
610             {
611                 Object key = getRepositoryKey( element );
612                 merged.put( key, element );
613             }
614 
615             for ( Repository element : src )
616             {
617                 Object key = getRepositoryKey( element );
618                 if ( sourceDominant || !merged.containsKey( key ) )
619                 {
620                     merged.put( key, element );
621                 }
622             }
623 
624             target.setPluginRepositories( new ArrayList<Repository>( merged.values() ) );
625         }
626     }
627 
628     protected void mergeModelBase_DistributionManagement( ModelBase target, ModelBase source, boolean sourceDominant,
629                                                           Map<Object, Object> context )
630     {
631         DistributionManagement src = source.getDistributionManagement();
632         if ( src != null )
633         {
634             DistributionManagement tgt = target.getDistributionManagement();
635             if ( tgt == null )
636             {
637                 tgt = new DistributionManagement();
638                 target.setDistributionManagement( tgt );
639             }
640             mergeDistributionManagement( tgt, src, sourceDominant, context );
641         }
642     }
643 
644     protected void mergeModelBase_Reporting( ModelBase target, ModelBase source, boolean sourceDominant,
645                                              Map<Object, Object> context )
646     {
647         Reporting src = source.getReporting();
648         if ( src != null )
649         {
650             Reporting tgt = target.getReporting();
651             if ( tgt == null )
652             {
653                 tgt = new Reporting();
654                 target.setReporting( tgt );
655             }
656             mergeReporting( tgt, src, sourceDominant, context );
657         }
658     }
659 
660     protected void mergeModelBase_DependencyManagement( ModelBase target, ModelBase source, boolean sourceDominant,
661                                                         Map<Object, Object> context )
662     {
663         DependencyManagement src = source.getDependencyManagement();
664         if ( src != null )
665         {
666             DependencyManagement tgt = target.getDependencyManagement();
667             if ( tgt == null )
668             {
669                 tgt = new DependencyManagement();
670                 target.setDependencyManagement( tgt );
671             }
672             mergeDependencyManagement( tgt, src, sourceDominant, context );
673         }
674     }
675 
676     protected void mergeModelBase_Properties( ModelBase target, ModelBase source, boolean sourceDominant,
677                                               Map<Object, Object> context )
678     {
679         Properties merged = new Properties();
680         if ( sourceDominant )
681         {
682             merged.putAll( target.getProperties() );
683             merged.putAll( source.getProperties() );
684         }
685         else
686         {
687             merged.putAll( source.getProperties() );
688             merged.putAll( target.getProperties() );
689         }
690         target.setProperties( merged );
691         target.setLocation( "properties", InputLocation.merge( target.getLocation( "properties" ),
692                                                                source.getLocation( "properties" ), sourceDominant ) );
693     }
694 
695     protected void mergeDistributionManagement( DistributionManagement target, DistributionManagement source,
696                                                 boolean sourceDominant, Map<Object, Object> context )
697     {
698         mergeDistributionManagement_Repository( target, source, sourceDominant, context );
699         mergeDistributionManagement_SnapshotRepository( target, source, sourceDominant, context );
700         mergeDistributionManagement_Site( target, source, sourceDominant, context );
701         mergeDistributionManagement_Status( target, source, sourceDominant, context );
702         mergeDistributionManagement_DownloadUrl( target, source, sourceDominant, context );
703     }
704 
705     protected void mergeDistributionManagement_Repository( DistributionManagement target,
706                                                            DistributionManagement source, boolean sourceDominant,
707                                                            Map<Object, Object> context )
708     {
709         DeploymentRepository src = source.getRepository();
710         if ( src != null )
711         {
712             DeploymentRepository tgt = target.getRepository();
713             if ( tgt == null )
714             {
715                 tgt = new DeploymentRepository();
716                 target.setRepository( tgt );
717             }
718             mergeDeploymentRepository( tgt, src, sourceDominant, context );
719         }
720     }
721 
722     protected void mergeDistributionManagement_SnapshotRepository( DistributionManagement target,
723                                                                    DistributionManagement source,
724                                                                    boolean sourceDominant,
725                                                                    Map<Object, Object> context )
726     {
727         DeploymentRepository src = source.getSnapshotRepository();
728         if ( src != null )
729         {
730             DeploymentRepository tgt = target.getSnapshotRepository();
731             if ( tgt == null )
732             {
733                 tgt = new DeploymentRepository();
734                 target.setSnapshotRepository( tgt );
735             }
736             mergeDeploymentRepository( tgt, src, sourceDominant, context );
737         }
738     }
739 
740     protected void mergeDistributionManagement_Site( DistributionManagement target, DistributionManagement source,
741                                                      boolean sourceDominant, Map<Object, Object> context )
742     {
743         Site src = source.getSite();
744         if ( src != null )
745         {
746             Site tgt = target.getSite();
747             if ( tgt == null )
748             {
749                 tgt = new Site();
750                 target.setSite( tgt );
751             }
752             mergeSite( tgt, src, sourceDominant, context );
753         }
754     }
755 
756     protected void mergeDistributionManagement_Status( DistributionManagement target, DistributionManagement source,
757                                                        boolean sourceDominant, Map<Object, Object> context )
758     {
759         String src = source.getStatus();
760         if ( src != null )
761         {
762             if ( sourceDominant || target.getStatus() == null )
763             {
764                 target.setStatus( src );
765                 target.setLocation( "status", source.getLocation( "status" ) );
766             }
767         }
768     }
769 
770     protected void mergeDistributionManagement_DownloadUrl( DistributionManagement target,
771                                                             DistributionManagement source, boolean sourceDominant,
772                                                             Map<Object, Object> context )
773     {
774         String src = source.getDownloadUrl();
775         if ( src != null )
776         {
777             if ( sourceDominant || target.getDownloadUrl() == null )
778             {
779                 target.setDownloadUrl( src );
780                 target.setLocation( "downloadUrl", source.getLocation( "downloadUrl" ) );
781             }
782         }
783     }
784 
785     protected void mergeRelocation( Relocation target, Relocation source, boolean sourceDominant,
786                                     Map<Object, Object> context )
787     {
788         mergeRelocation_GroupId( target, source, sourceDominant, context );
789         mergeRelocation_ArtifactId( target, source, sourceDominant, context );
790         mergeRelocation_Version( target, source, sourceDominant, context );
791         mergeRelocation_Message( target, source, sourceDominant, context );
792     }
793 
794     protected void mergeRelocation_GroupId( Relocation target, Relocation source, boolean sourceDominant,
795                                             Map<Object, Object> context )
796     {
797         String src = source.getGroupId();
798         if ( src != null )
799         {
800             if ( sourceDominant || target.getGroupId() == null )
801             {
802                 target.setGroupId( src );
803                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
804             }
805         }
806     }
807 
808     protected void mergeRelocation_ArtifactId( Relocation target, Relocation source, boolean sourceDominant,
809                                                Map<Object, Object> context )
810     {
811         String src = source.getArtifactId();
812         if ( src != null )
813         {
814             if ( sourceDominant || target.getArtifactId() == null )
815             {
816                 target.setArtifactId( src );
817                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
818             }
819         }
820     }
821 
822     protected void mergeRelocation_Version( Relocation target, Relocation source, boolean sourceDominant,
823                                             Map<Object, Object> context )
824     {
825         String src = source.getVersion();
826         if ( src != null )
827         {
828             if ( sourceDominant || target.getVersion() == null )
829             {
830                 target.setVersion( src );
831                 target.setLocation( "version", source.getLocation( "version" ) );
832             }
833         }
834     }
835 
836     protected void mergeRelocation_Message( Relocation target, Relocation source, boolean sourceDominant,
837                                             Map<Object, Object> context )
838     {
839         String src = source.getMessage();
840         if ( src != null )
841         {
842             if ( sourceDominant || target.getMessage() == null )
843             {
844                 target.setMessage( src );
845                 target.setLocation( "message", source.getLocation( "message" ) );
846             }
847         }
848     }
849 
850     protected void mergeDeploymentRepository( DeploymentRepository target, DeploymentRepository source,
851                                               boolean sourceDominant, Map<Object, Object> context )
852     {
853         mergeRepository( target, source, sourceDominant, context );
854         mergeDeploymentRepository_UniqueVersion( target, source, sourceDominant, context );
855     }
856 
857     protected void mergeDeploymentRepository_UniqueVersion( DeploymentRepository target, DeploymentRepository source,
858                                                             boolean sourceDominant, Map<Object, Object> context )
859     {
860         if ( sourceDominant )
861         {
862             target.setUniqueVersion( source.isUniqueVersion() );
863             target.setLocation( "uniqueVersion", source.getLocation( "uniqueVersion" ) );
864         }
865     }
866 
867     protected void mergeSite( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
868     {
869         mergeSite_Id( target, source, sourceDominant, context );
870         mergeSite_Name( target, source, sourceDominant, context );
871         mergeSite_Url( target, source, sourceDominant, context );
872     }
873 
874     protected void mergeSite_Id( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
875     {
876         String src = source.getId();
877         if ( src != null )
878         {
879             if ( sourceDominant || target.getId() == null )
880             {
881                 target.setId( src );
882                 target.setLocation( "id", source.getLocation( "id" ) );
883             }
884         }
885     }
886 
887     protected void mergeSite_Name( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
888     {
889         String src = source.getName();
890         if ( src != null )
891         {
892             if ( sourceDominant || target.getName() == null )
893             {
894                 target.setName( src );
895                 target.setLocation( "name", source.getLocation( "name" ) );
896             }
897         }
898     }
899 
900     protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
901     {
902         String src = source.getUrl();
903         if ( src != null )
904         {
905             if ( sourceDominant || target.getUrl() == null )
906             {
907                 target.setUrl( src );
908                 target.setLocation( "url", source.getLocation( "url" ) );
909             }
910         }
911     }
912 
913     protected void mergeRepository( Repository target, Repository source, boolean sourceDominant,
914                                     Map<Object, Object> context )
915     {
916         mergeRepositoryBase( target, source, sourceDominant, context );
917         mergeRepository_Releases( target, source, sourceDominant, context );
918         mergeRepository_Snapshots( target, source, sourceDominant, context );
919     }
920 
921     protected void mergeRepository_Releases( Repository target, Repository source, boolean sourceDominant,
922                                              Map<Object, Object> context )
923     {
924         RepositoryPolicy src = source.getReleases();
925         if ( src != null )
926         {
927             RepositoryPolicy tgt = target.getReleases();
928             if ( tgt == null )
929             {
930                 tgt = new RepositoryPolicy();
931                 target.setReleases( tgt );
932             }
933             mergeRepositoryPolicy( tgt, src, sourceDominant, context );
934         }
935     }
936 
937     protected void mergeRepository_Snapshots( Repository target, Repository source, boolean sourceDominant,
938                                               Map<Object, Object> context )
939     {
940         RepositoryPolicy src = source.getSnapshots();
941         if ( src != null )
942         {
943             RepositoryPolicy tgt = target.getSnapshots();
944             if ( tgt == null )
945             {
946                 tgt = new RepositoryPolicy();
947                 target.setSnapshots( tgt );
948             }
949             mergeRepositoryPolicy( tgt, src, sourceDominant, context );
950         }
951     }
952 
953     protected void mergeRepositoryBase( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
954                                         Map<Object, Object> context )
955     {
956         mergeRepositoryBase_Id( target, source, sourceDominant, context );
957         mergeRepositoryBase_Name( target, source, sourceDominant, context );
958         mergeRepositoryBase_Url( target, source, sourceDominant, context );
959         mergeRepositoryBase_Layout( target, source, sourceDominant, context );
960     }
961 
962     protected void mergeRepositoryBase_Id( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
963                                            Map<Object, Object> context )
964     {
965         String src = source.getId();
966         if ( src != null )
967         {
968             if ( sourceDominant || target.getId() == null )
969             {
970                 target.setId( src );
971                 target.setLocation( "id", source.getLocation( "id" ) );
972             }
973         }
974     }
975 
976     protected void mergeRepositoryBase_Url( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
977                                             Map<Object, Object> context )
978     {
979         String src = source.getUrl();
980         if ( src != null )
981         {
982             if ( sourceDominant || target.getUrl() == null )
983             {
984                 target.setUrl( src );
985                 target.setLocation( "url", source.getLocation( "url" ) );
986             }
987         }
988     }
989 
990     protected void mergeRepositoryBase_Name( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
991                                              Map<Object, Object> context )
992     {
993         String src = source.getName();
994         if ( src != null )
995         {
996             if ( sourceDominant || target.getName() == null )
997             {
998                 target.setName( src );
999                 target.setLocation( "name", source.getLocation( "name" ) );
1000             }
1001         }
1002     }
1003 
1004     protected void mergeRepositoryBase_Layout( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
1005                                                Map<Object, Object> context )
1006     {
1007         String src = source.getLayout();
1008         if ( src != null )
1009         {
1010             if ( sourceDominant || target.getLayout() == null )
1011             {
1012                 target.setLayout( src );
1013                 target.setLocation( "layout", source.getLocation( "layout" ) );
1014             }
1015         }
1016     }
1017 
1018     protected void mergeRepositoryPolicy( RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant,
1019                                           Map<Object, Object> context )
1020     {
1021         mergeRepositoryPolicy_Enabled( target, source, sourceDominant, context );
1022         mergeRepositoryPolicy_UpdatePolicy( target, source, sourceDominant, context );
1023         mergeRepositoryPolicy_ChecksumPolicy( target, source, sourceDominant, context );
1024     }
1025 
1026     protected void mergeRepositoryPolicy_Enabled( RepositoryPolicy target, RepositoryPolicy source,
1027                                                   boolean sourceDominant, Map<Object, Object> context )
1028     {
1029         String src = source.getEnabled();
1030         if ( src != null )
1031         {
1032             if ( sourceDominant || target.getEnabled() == null )
1033             {
1034                 target.setEnabled( src );
1035                 target.setLocation( "enabled", source.getLocation( "enabled" ) );
1036             }
1037         }
1038     }
1039 
1040     protected void mergeRepositoryPolicy_UpdatePolicy( RepositoryPolicy target, RepositoryPolicy source,
1041                                                        boolean sourceDominant, Map<Object, Object> context )
1042     {
1043         String src = source.getUpdatePolicy();
1044         if ( src != null )
1045         {
1046             if ( sourceDominant || target.getUpdatePolicy() == null )
1047             {
1048                 target.setUpdatePolicy( src );
1049                 target.setLocation( "updatePolicy", source.getLocation( "updatePolicy" ) );
1050             }
1051         }
1052     }
1053 
1054     protected void mergeRepositoryPolicy_ChecksumPolicy( RepositoryPolicy target, RepositoryPolicy source,
1055                                                          boolean sourceDominant, Map<Object, Object> context )
1056     {
1057         String src = source.getChecksumPolicy();
1058         if ( src != null )
1059         {
1060             if ( sourceDominant || target.getChecksumPolicy() == null )
1061             {
1062                 target.setChecksumPolicy( src );
1063                 target.setLocation( "checksumPolicy", source.getLocation( "checksumPolicy" ) );
1064             }
1065         }
1066     }
1067 
1068     protected void mergeDependency( Dependency target, Dependency source, boolean sourceDominant,
1069                                     Map<Object, Object> context )
1070     {
1071         mergeDependency_GroupId( target, source, sourceDominant, context );
1072         mergeDependency_ArtifactId( target, source, sourceDominant, context );
1073         mergeDependency_Version( target, source, sourceDominant, context );
1074         mergeDependency_Type( target, source, sourceDominant, context );
1075         mergeDependency_Classifier( target, source, sourceDominant, context );
1076         mergeDependency_Scope( target, source, sourceDominant, context );
1077         mergeDependency_SystemPath( target, source, sourceDominant, context );
1078         mergeDependency_Optional( target, source, sourceDominant, context );
1079         mergeDependency_Exclusions( target, source, sourceDominant, context );
1080     }
1081 
1082     protected void mergeDependency_GroupId( Dependency target, Dependency source, boolean sourceDominant,
1083                                             Map<Object, Object> context )
1084     {
1085         String src = source.getGroupId();
1086         if ( src != null )
1087         {
1088             if ( sourceDominant || target.getGroupId() == null )
1089             {
1090                 target.setGroupId( src );
1091                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1092             }
1093         }
1094     }
1095 
1096     protected void mergeDependency_ArtifactId( Dependency target, Dependency source, boolean sourceDominant,
1097                                                Map<Object, Object> context )
1098     {
1099         String src = source.getArtifactId();
1100         if ( src != null )
1101         {
1102             if ( sourceDominant || target.getArtifactId() == null )
1103             {
1104                 target.setArtifactId( src );
1105                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1106             }
1107         }
1108     }
1109 
1110     protected void mergeDependency_Version( Dependency target, Dependency source, boolean sourceDominant,
1111                                             Map<Object, Object> context )
1112     {
1113         String src = source.getVersion();
1114         if ( src != null )
1115         {
1116             if ( sourceDominant || target.getVersion() == null )
1117             {
1118                 target.setVersion( src );
1119                 target.setLocation( "version", source.getLocation( "version" ) );
1120             }
1121         }
1122     }
1123 
1124     protected void mergeDependency_Type( Dependency target, Dependency source, boolean sourceDominant,
1125                                          Map<Object, Object> context )
1126     {
1127         String src = source.getType();
1128         if ( src != null )
1129         {
1130             if ( sourceDominant || target.getType() == null )
1131             {
1132                 target.setType( src );
1133                 target.setLocation( "type", source.getLocation( "type" ) );
1134             }
1135         }
1136     }
1137 
1138     protected void mergeDependency_Classifier( Dependency target, Dependency source, boolean sourceDominant,
1139                                                Map<Object, Object> context )
1140     {
1141         String src = source.getClassifier();
1142         if ( src != null )
1143         {
1144             if ( sourceDominant || target.getClassifier() == null )
1145             {
1146                 target.setClassifier( src );
1147                 target.setLocation( "classifier", source.getLocation( "classifier" ) );
1148             }
1149         }
1150     }
1151 
1152     protected void mergeDependency_Scope( Dependency target, Dependency source, boolean sourceDominant,
1153                                           Map<Object, Object> context )
1154     {
1155         String src = source.getScope();
1156         if ( src != null )
1157         {
1158             if ( sourceDominant || target.getScope() == null )
1159             {
1160                 target.setScope( src );
1161                 target.setLocation( "scope", source.getLocation( "scope" ) );
1162             }
1163         }
1164     }
1165 
1166     protected void mergeDependency_SystemPath( Dependency target, Dependency source, boolean sourceDominant,
1167                                                Map<Object, Object> context )
1168     {
1169         String src = source.getSystemPath();
1170         if ( src != null )
1171         {
1172             if ( sourceDominant || target.getSystemPath() == null )
1173             {
1174                 target.setSystemPath( src );
1175                 target.setLocation( "systemPath", source.getLocation( "systemPath" ) );
1176             }
1177         }
1178     }
1179 
1180     protected void mergeDependency_Optional( Dependency target, Dependency source, boolean sourceDominant,
1181                                              Map<Object, Object> context )
1182     {
1183         String src = source.getOptional();
1184         if ( src != null )
1185         {
1186             if ( sourceDominant || target.getOptional() == null )
1187             {
1188                 target.setOptional( src );
1189                 target.setLocation( "optional", source.getLocation( "optional" ) );
1190             }
1191         }
1192     }
1193 
1194     protected void mergeDependency_Exclusions( Dependency target, Dependency source, boolean sourceDominant,
1195                                                Map<Object, Object> context )
1196     {
1197         List<Exclusion> src = source.getExclusions();
1198         if ( !src.isEmpty() )
1199         {
1200             List<Exclusion> tgt = target.getExclusions();
1201 
1202             Map<Object, Exclusion> merged = new LinkedHashMap<Object, Exclusion>( ( src.size() + tgt.size() ) * 2 );
1203 
1204             for ( Exclusion element : tgt )
1205             {
1206                 Object key = getExclusionKey( element );
1207                 merged.put( key, element );
1208             }
1209 
1210             for ( Exclusion element : src )
1211             {
1212                 Object key = getExclusionKey( element );
1213                 if ( sourceDominant || !merged.containsKey( key ) )
1214                 {
1215                     merged.put( key, element );
1216                 }
1217             }
1218 
1219             target.setExclusions( new ArrayList<Exclusion>( merged.values() ) );
1220         }
1221     }
1222 
1223     protected void mergeExclusion( Exclusion target, Exclusion source, boolean sourceDominant,
1224                                    Map<Object, Object> context )
1225     {
1226         mergeExclusion_GroupId( target, source, sourceDominant, context );
1227         mergeExclusion_ArtifactId( target, source, sourceDominant, context );
1228     }
1229 
1230     protected void mergeExclusion_GroupId( Exclusion target, Exclusion source, boolean sourceDominant,
1231                                            Map<Object, Object> context )
1232     {
1233         String src = source.getGroupId();
1234         if ( src != null )
1235         {
1236             if ( sourceDominant || target.getGroupId() == null )
1237             {
1238                 target.setGroupId( src );
1239                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1240             }
1241         }
1242     }
1243 
1244     protected void mergeExclusion_ArtifactId( Exclusion target, Exclusion source, boolean sourceDominant,
1245                                               Map<Object, Object> context )
1246     {
1247         String src = source.getArtifactId();
1248         if ( src != null )
1249         {
1250             if ( sourceDominant || target.getArtifactId() == null )
1251             {
1252                 target.setArtifactId( src );
1253                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1254             }
1255         }
1256     }
1257 
1258     protected void mergeReporting( Reporting target, Reporting source, boolean sourceDominant,
1259                                    Map<Object, Object> context )
1260     {
1261         mergeReporting_OutputDirectory( target, source, sourceDominant, context );
1262         mergeReporting_ExcludeDefaults( target, source, sourceDominant, context );
1263         mergeReporting_Plugins( target, source, sourceDominant, context );
1264     }
1265 
1266     protected void mergeReporting_OutputDirectory( Reporting target, Reporting source, boolean sourceDominant,
1267                                                    Map<Object, Object> context )
1268     {
1269         String src = source.getOutputDirectory();
1270         if ( src != null )
1271         {
1272             if ( sourceDominant || target.getOutputDirectory() == null )
1273             {
1274                 target.setOutputDirectory( src );
1275                 target.setLocation( "outputDirectory", source.getLocation( "outputDirectory" ) );
1276             }
1277         }
1278     }
1279 
1280     protected void mergeReporting_ExcludeDefaults( Reporting target, Reporting source, boolean sourceDominant,
1281                                                    Map<Object, Object> context )
1282     {
1283         String src = source.getExcludeDefaults();
1284         if ( src != null )
1285         {
1286             if ( sourceDominant || target.getExcludeDefaults() == null )
1287             {
1288                 target.setExcludeDefaults( src );
1289                 target.setLocation( "excludeDefaults", source.getLocation( "excludeDefaults" ) );
1290             }
1291         }
1292     }
1293 
1294     protected void mergeReporting_Plugins( Reporting target, Reporting source, boolean sourceDominant,
1295                                            Map<Object, Object> context )
1296     {
1297         List<ReportPlugin> src = source.getPlugins();
1298         if ( !src.isEmpty() )
1299         {
1300             List<ReportPlugin> tgt = target.getPlugins();
1301             Map<Object, ReportPlugin> merged =
1302                 new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
1303 
1304             for ( ReportPlugin element : tgt )
1305             {
1306                 Object key = getReportPluginKey( element );
1307                 merged.put( key, element );
1308             }
1309 
1310             for ( ReportPlugin element : src )
1311             {
1312                 Object key = getReportPluginKey( element );
1313                 if ( sourceDominant || !merged.containsKey( key ) )
1314                 {
1315                     merged.put( key, element );
1316                 }
1317             }
1318 
1319             target.setPlugins( new ArrayList<ReportPlugin>( merged.values() ) );
1320         }
1321     }
1322 
1323     protected void mergeReportPlugin( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1324                                       Map<Object, Object> context )
1325     {
1326         mergeConfigurationContainer( target, source, sourceDominant, context );
1327         mergeReportPlugin_GroupId( target, source, sourceDominant, context );
1328         mergeReportPlugin_ArtifactId( target, source, sourceDominant, context );
1329         mergeReportPlugin_Version( target, source, sourceDominant, context );
1330         mergeReportPlugin_ReportSets( target, source, sourceDominant, context );
1331     }
1332 
1333     protected void mergeReportPlugin_GroupId( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1334                                               Map<Object, Object> context )
1335     {
1336         String src = source.getGroupId();
1337         if ( src != null )
1338         {
1339             if ( sourceDominant || target.getGroupId() == null )
1340             {
1341                 target.setGroupId( src );
1342                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1343             }
1344         }
1345     }
1346 
1347     protected void mergeReportPlugin_ArtifactId( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1348                                                  Map<Object, Object> context )
1349     {
1350         String src = source.getArtifactId();
1351         if ( src != null )
1352         {
1353             if ( sourceDominant || target.getArtifactId() == null )
1354             {
1355                 target.setArtifactId( src );
1356                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1357             }
1358         }
1359     }
1360 
1361     protected void mergeReportPlugin_Version( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1362                                               Map<Object, Object> context )
1363     {
1364         String src = source.getVersion();
1365         if ( src != null )
1366         {
1367             if ( sourceDominant || target.getVersion() == null )
1368             {
1369                 target.setVersion( src );
1370                 target.setLocation( "version", source.getLocation( "version" ) );
1371             }
1372         }
1373     }
1374 
1375     protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1376                                                  Map<Object, Object> context )
1377     {
1378         List<ReportSet> src = source.getReportSets();
1379         if ( !src.isEmpty() )
1380         {
1381             List<ReportSet> tgt = target.getReportSets();
1382             Map<Object, ReportSet> merged = new LinkedHashMap<Object, ReportSet>( ( src.size() + tgt.size() ) * 2 );
1383 
1384             for ( ReportSet element : tgt )
1385             {
1386                 Object key = getReportSetKey( element );
1387                 merged.put( key, element );
1388             }
1389 
1390             for ( ReportSet element : src )
1391             {
1392                 Object key = getReportSetKey( element );
1393                 if ( sourceDominant || !merged.containsKey( key ) )
1394                 {
1395                     merged.put( key, element );
1396                 }
1397             }
1398 
1399             target.setReportSets( new ArrayList<ReportSet>( merged.values() ) );
1400         }
1401     }
1402 
1403     protected void mergeReportSet( ReportSet target, ReportSet source, boolean sourceDominant,
1404                                    Map<Object, Object> context )
1405     {
1406         mergeConfigurationContainer( target, source, sourceDominant, context );
1407         mergeReportSet_Id( target, source, sourceDominant, context );
1408         mergeReportSet_Reports( target, source, sourceDominant, context );
1409     }
1410 
1411     protected void mergeReportSet_Id( ReportSet target, ReportSet source, boolean sourceDominant,
1412                                       Map<Object, Object> context )
1413     {
1414         String src = source.getId();
1415         if ( src != null )
1416         {
1417             if ( sourceDominant || target.getId() == null )
1418             {
1419                 target.setId( src );
1420                 target.setLocation( "id", source.getLocation( "id" ) );
1421             }
1422         }
1423     }
1424 
1425     protected void mergeReportSet_Reports( ReportSet target, ReportSet source, boolean sourceDominant,
1426                                            Map<Object, Object> context )
1427     {
1428         List<String> src = source.getReports();
1429         if ( !src.isEmpty() )
1430         {
1431             List<String> tgt = target.getReports();
1432             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
1433             merged.addAll( tgt );
1434             merged.addAll( src );
1435             target.setReports( merged );
1436         }
1437     }
1438 
1439     protected void mergeDependencyManagement( DependencyManagement target, DependencyManagement source,
1440                                               boolean sourceDominant, Map<Object, Object> context )
1441     {
1442         mergeDependencyManagement_Dependencies( target, source, sourceDominant, context );
1443     }
1444 
1445     protected void mergeDependencyManagement_Dependencies( DependencyManagement target, DependencyManagement source,
1446                                                            boolean sourceDominant, Map<Object, Object> context )
1447     {
1448         List<Dependency> src = source.getDependencies();
1449         if ( !src.isEmpty() )
1450         {
1451             List<Dependency> tgt = target.getDependencies();
1452             Map<Object, Dependency> merged = new LinkedHashMap<Object, Dependency>( ( src.size() + tgt.size() ) * 2 );
1453 
1454             for ( Dependency element : tgt )
1455             {
1456                 Object key = getDependencyKey( element );
1457                 merged.put( key, element );
1458             }
1459 
1460             for ( Dependency element : src )
1461             {
1462                 Object key = getDependencyKey( element );
1463                 if ( sourceDominant || !merged.containsKey( key ) )
1464                 {
1465                     merged.put( key, element );
1466                 }
1467             }
1468 
1469             target.setDependencies( new ArrayList<Dependency>( merged.values() ) );
1470         }
1471     }
1472 
1473     protected void mergeParent( Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1474     {
1475         mergeParent_GroupId( target, source, sourceDominant, context );
1476         mergeParent_ArtifactId( target, source, sourceDominant, context );
1477         mergeParent_Version( target, source, sourceDominant, context );
1478         mergeParent_RelativePath( target, source, sourceDominant, context );
1479     }
1480 
1481     protected void mergeParent_GroupId( Parent target, Parent source, boolean sourceDominant,
1482                                         Map<Object, Object> context )
1483     {
1484         String src = source.getGroupId();
1485         if ( src != null )
1486         {
1487             if ( sourceDominant || target.getGroupId() == null )
1488             {
1489                 target.setGroupId( src );
1490                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1491             }
1492         }
1493     }
1494 
1495     protected void mergeParent_ArtifactId( Parent target, Parent source, boolean sourceDominant,
1496                                            Map<Object, Object> context )
1497     {
1498         String src = source.getArtifactId();
1499         if ( src != null )
1500         {
1501             if ( sourceDominant || target.getArtifactId() == null )
1502             {
1503                 target.setArtifactId( src );
1504                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1505             }
1506         }
1507     }
1508 
1509     protected void mergeParent_Version( Parent target, Parent source, boolean sourceDominant,
1510                                         Map<Object, Object> context )
1511     {
1512         String src = source.getVersion();
1513         if ( src != null )
1514         {
1515             if ( sourceDominant || target.getVersion() == null )
1516             {
1517                 target.setVersion( src );
1518                 target.setLocation( "version", source.getLocation( "version" ) );
1519             }
1520         }
1521     }
1522 
1523     protected void mergeParent_RelativePath( Parent target, Parent source, boolean sourceDominant,
1524                                              Map<Object, Object> context )
1525     {
1526         String src = source.getRelativePath();
1527         if ( src != null )
1528         {
1529             if ( sourceDominant || target.getRelativePath() == null )
1530             {
1531                 target.setRelativePath( src );
1532                 target.setLocation( "relativePath", source.getLocation( "relativePath" ) );
1533             }
1534         }
1535     }
1536 
1537     protected void mergeOrganization( Organization target, Organization source, boolean sourceDominant,
1538                                       Map<Object, Object> context )
1539     {
1540         mergeOrganization_Name( target, source, sourceDominant, context );
1541         mergeOrganization_Url( target, source, sourceDominant, context );
1542     }
1543 
1544     protected void mergeOrganization_Name( Organization target, Organization source, boolean sourceDominant,
1545                                            Map<Object, Object> context )
1546     {
1547         String src = source.getName();
1548         if ( src != null )
1549         {
1550             if ( sourceDominant || target.getName() == null )
1551             {
1552                 target.setName( src );
1553                 target.setLocation( "name", source.getLocation( "name" ) );
1554             }
1555         }
1556     }
1557 
1558     protected void mergeOrganization_Url( Organization target, Organization source, boolean sourceDominant,
1559                                           Map<Object, Object> context )
1560     {
1561         String src = source.getUrl();
1562         if ( src != null )
1563         {
1564             if ( sourceDominant || target.getUrl() == null )
1565             {
1566                 target.setUrl( src );
1567                 target.setLocation( "url", source.getLocation( "url" ) );
1568             }
1569         }
1570     }
1571 
1572     protected void mergeLicense( License target, License source, boolean sourceDominant, Map<Object, Object> context )
1573     {
1574         mergeLicense_Name( target, source, sourceDominant, context );
1575         mergeLicense_Url( target, source, sourceDominant, context );
1576         mergeLicense_Distribution( target, source, sourceDominant, context );
1577         mergeLicense_Comments( target, source, sourceDominant, context );
1578     }
1579 
1580     protected void mergeLicense_Name( License target, License source, boolean sourceDominant,
1581                                       Map<Object, Object> context )
1582     {
1583         String src = source.getName();
1584         if ( src != null )
1585         {
1586             if ( sourceDominant || target.getName() == null )
1587             {
1588                 target.setName( src );
1589                 target.setLocation( "name", source.getLocation( "name" ) );
1590             }
1591         }
1592     }
1593 
1594     protected void mergeLicense_Url( License target, License source, boolean sourceDominant,
1595                                      Map<Object, Object> context )
1596     {
1597         String src = source.getUrl();
1598         if ( src != null )
1599         {
1600             if ( sourceDominant || target.getUrl() == null )
1601             {
1602                 target.setUrl( src );
1603                 target.setLocation( "url", source.getLocation( "url" ) );
1604             }
1605         }
1606     }
1607 
1608     protected void mergeLicense_Distribution( License target, License source, boolean sourceDominant,
1609                                               Map<Object, Object> context )
1610     {
1611         String src = source.getDistribution();
1612         if ( src != null )
1613         {
1614             if ( sourceDominant || target.getDistribution() == null )
1615             {
1616                 target.setDistribution( src );
1617                 target.setLocation( "distribution", source.getLocation( "distribution" ) );
1618             }
1619         }
1620     }
1621 
1622     protected void mergeLicense_Comments( License target, License source, boolean sourceDominant,
1623                                           Map<Object, Object> context )
1624     {
1625         String src = source.getComments();
1626         if ( src != null )
1627         {
1628             if ( sourceDominant || target.getComments() == null )
1629             {
1630                 target.setComments( src );
1631                 target.setLocation( "comments", source.getLocation( "comments" ) );
1632             }
1633         }
1634     }
1635 
1636     protected void mergeMailingList( MailingList target, MailingList source, boolean sourceDominant,
1637                                      Map<Object, Object> context )
1638     {
1639         mergeMailingList_Name( target, source, sourceDominant, context );
1640         mergeMailingList_Subscribe( target, source, sourceDominant, context );
1641         mergeMailingList_Unsubscribe( target, source, sourceDominant, context );
1642         mergeMailingList_Post( target, source, sourceDominant, context );
1643         mergeMailingList_OtherArchives( target, source, sourceDominant, context );
1644     }
1645 
1646     protected void mergeMailingList_Name( MailingList target, MailingList source, boolean sourceDominant,
1647                                           Map<Object, Object> context )
1648     {
1649         String src = source.getName();
1650         if ( src != null )
1651         {
1652             if ( sourceDominant || target.getName() == null )
1653             {
1654                 target.setName( src );
1655                 target.setLocation( "name", source.getLocation( "name" ) );
1656             }
1657         }
1658     }
1659 
1660     protected void mergeMailingList_Subscribe( MailingList target, MailingList source, boolean sourceDominant,
1661                                                Map<Object, Object> context )
1662     {
1663         String src = source.getSubscribe();
1664         if ( src != null )
1665         {
1666             if ( sourceDominant || target.getSubscribe() == null )
1667             {
1668                 target.setSubscribe( src );
1669                 target.setLocation( "subscribe", source.getLocation( "subscribe" ) );
1670             }
1671         }
1672     }
1673 
1674     protected void mergeMailingList_Unsubscribe( MailingList target, MailingList source, boolean sourceDominant,
1675                                                  Map<Object, Object> context )
1676     {
1677         String src = source.getUnsubscribe();
1678         if ( src != null )
1679         {
1680             if ( sourceDominant || target.getUnsubscribe() == null )
1681             {
1682                 target.setUnsubscribe( src );
1683                 target.setLocation( "unsubscribe", source.getLocation( "unsubscribe" ) );
1684             }
1685         }
1686     }
1687 
1688     protected void mergeMailingList_Post( MailingList target, MailingList source, boolean sourceDominant,
1689                                           Map<Object, Object> context )
1690     {
1691         String src = source.getPost();
1692         if ( src != null )
1693         {
1694             if ( sourceDominant || target.getPost() == null )
1695             {
1696                 target.setPost( src );
1697                 target.setLocation( "post", source.getLocation( "post" ) );
1698             }
1699         }
1700     }
1701 
1702     protected void mergeMailingList_Archive( MailingList target, MailingList source, boolean sourceDominant,
1703                                              Map<Object, Object> context )
1704     {
1705         String src = source.getArchive();
1706         if ( src != null )
1707         {
1708             if ( sourceDominant || target.getArchive() == null )
1709             {
1710                 target.setArchive( src );
1711                 target.setLocation( "archive", source.getLocation( "archive" ) );
1712             }
1713         }
1714     }
1715 
1716     protected void mergeMailingList_OtherArchives( MailingList target, MailingList source, boolean sourceDominant,
1717                                                    Map<Object, Object> context )
1718     {
1719         List<String> src = source.getOtherArchives();
1720         if ( !src.isEmpty() )
1721         {
1722             List<String> tgt = target.getOtherArchives();
1723             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
1724             merged.addAll( tgt );
1725             merged.addAll( src );
1726             target.setOtherArchives( merged );
1727         }
1728     }
1729 
1730     protected void mergeDeveloper( Developer target, Developer source, boolean sourceDominant,
1731                                    Map<Object, Object> context )
1732     {
1733         mergeContributor( target, source, sourceDominant, context );
1734         mergeDeveloper_Id( target, source, sourceDominant, context );
1735     }
1736 
1737     protected void mergeDeveloper_Id( Developer target, Developer source, boolean sourceDominant,
1738                                       Map<Object, Object> context )
1739     {
1740         String src = source.getId();
1741         if ( src != null )
1742         {
1743             if ( sourceDominant || target.getId() == null )
1744             {
1745                 target.setId( src );
1746                 target.setLocation( "id", source.getLocation( "id" ) );
1747             }
1748         }
1749     }
1750 
1751     protected void mergeContributor( Contributor target, Contributor source, boolean sourceDominant,
1752                                      Map<Object, Object> context )
1753     {
1754         mergeContributor_Name( target, source, sourceDominant, context );
1755         mergeContributor_Email( target, source, sourceDominant, context );
1756         mergeContributor_Url( target, source, sourceDominant, context );
1757         mergeContributor_Organization( target, source, sourceDominant, context );
1758         mergeContributor_OrganizationUrl( target, source, sourceDominant, context );
1759         mergeContributor_Timezone( target, source, sourceDominant, context );
1760         mergeContributor_Roles( target, source, sourceDominant, context );
1761         mergeContributor_Properties( target, source, sourceDominant, context );
1762     }
1763 
1764     protected void mergeContributor_Name( Contributor target, Contributor source, boolean sourceDominant,
1765                                           Map<Object, Object> context )
1766     {
1767         String src = source.getName();
1768         if ( src != null )
1769         {
1770             if ( sourceDominant || target.getName() == null )
1771             {
1772                 target.setName( src );
1773                 target.setLocation( "name", source.getLocation( "name" ) );
1774             }
1775         }
1776     }
1777 
1778     protected void mergeContributor_Email( Contributor target, Contributor source, boolean sourceDominant,
1779                                            Map<Object, Object> context )
1780     {
1781         String src = source.getEmail();
1782         if ( src != null )
1783         {
1784             if ( sourceDominant || target.getEmail() == null )
1785             {
1786                 target.setEmail( src );
1787                 target.setLocation( "email", source.getLocation( "email" ) );
1788             }
1789         }
1790     }
1791 
1792     protected void mergeContributor_Url( Contributor target, Contributor source, boolean sourceDominant,
1793                                          Map<Object, Object> context )
1794     {
1795         String src = source.getUrl();
1796         if ( src != null )
1797         {
1798             if ( sourceDominant || target.getUrl() == null )
1799             {
1800                 target.setUrl( src );
1801                 target.setLocation( "url", source.getLocation( "url" ) );
1802             }
1803         }
1804     }
1805 
1806     protected void mergeContributor_Organization( Contributor target, Contributor source, boolean sourceDominant,
1807                                                   Map<Object, Object> context )
1808     {
1809         String src = source.getOrganization();
1810         if ( src != null )
1811         {
1812             if ( sourceDominant || target.getOrganization() == null )
1813             {
1814                 target.setOrganization( src );
1815                 target.setLocation( "organization", source.getLocation( "organization" ) );
1816             }
1817         }
1818     }
1819 
1820     protected void mergeContributor_OrganizationUrl( Contributor target, Contributor source, boolean sourceDominant,
1821                                                      Map<Object, Object> context )
1822     {
1823         String src = source.getOrganizationUrl();
1824         if ( src != null )
1825         {
1826             if ( sourceDominant || target.getOrganizationUrl() == null )
1827             {
1828                 target.setOrganizationUrl( src );
1829                 target.setLocation( "organizationUrl", source.getLocation( "organizationUrl" ) );
1830             }
1831         }
1832     }
1833 
1834     protected void mergeContributor_Timezone( Contributor target, Contributor source, boolean sourceDominant,
1835                                               Map<Object, Object> context )
1836     {
1837         String src = source.getTimezone();
1838         if ( src != null )
1839         {
1840             if ( sourceDominant || target.getTimezone() == null )
1841             {
1842                 target.setTimezone( src );
1843                 target.setLocation( "timezone", source.getLocation( "timezone" ) );
1844             }
1845         }
1846     }
1847 
1848     protected void mergeContributor_Roles( Contributor target, Contributor source, boolean sourceDominant,
1849                                            Map<Object, Object> context )
1850     {
1851         List<String> src = source.getRoles();
1852         if ( !src.isEmpty() )
1853         {
1854             List<String> tgt = target.getRoles();
1855             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
1856             merged.addAll( tgt );
1857             merged.addAll( src );
1858             target.setRoles( merged );
1859         }
1860     }
1861 
1862     protected void mergeContributor_Properties( Contributor target, Contributor source, boolean sourceDominant,
1863                                                 Map<Object, Object> context )
1864     {
1865         Properties merged = new Properties();
1866         if ( sourceDominant )
1867         {
1868             merged.putAll( target.getProperties() );
1869             merged.putAll( source.getProperties() );
1870         }
1871         else
1872         {
1873             merged.putAll( source.getProperties() );
1874             merged.putAll( target.getProperties() );
1875         }
1876         target.setProperties( merged );
1877         target.setLocation( "properties", InputLocation.merge( target.getLocation( "properties" ),
1878                                                                source.getLocation( "properties" ), sourceDominant ) );
1879     }
1880 
1881     protected void mergeIssueManagement( IssueManagement target, IssueManagement source, boolean sourceDominant,
1882                                          Map<Object, Object> context )
1883     {
1884         mergeIssueManagement_Url( target, source, sourceDominant, context );
1885         mergeIssueManagement_System( target, source, sourceDominant, context );
1886     }
1887 
1888     protected void mergeIssueManagement_System( IssueManagement target, IssueManagement source, boolean sourceDominant,
1889                                                 Map<Object, Object> context )
1890     {
1891         String src = source.getSystem();
1892         if ( src != null )
1893         {
1894             if ( sourceDominant || target.getSystem() == null )
1895             {
1896                 target.setSystem( src );
1897                 target.setLocation( "system", source.getLocation( "system" ) );
1898             }
1899         }
1900     }
1901 
1902     protected void mergeIssueManagement_Url( IssueManagement target, IssueManagement source, boolean sourceDominant,
1903                                              Map<Object, Object> context )
1904     {
1905         String src = source.getUrl();
1906         if ( src != null )
1907         {
1908             if ( sourceDominant || target.getUrl() == null )
1909             {
1910                 target.setUrl( src );
1911                 target.setLocation( "url", source.getLocation( "url" ) );
1912             }
1913         }
1914     }
1915 
1916     protected void mergeScm( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1917     {
1918         mergeScm_Url( target, source, sourceDominant, context );
1919         mergeScm_Connection( target, source, sourceDominant, context );
1920         mergeScm_DeveloperConnection( target, source, sourceDominant, context );
1921         mergeScm_Tag( target, source, sourceDominant, context );
1922     }
1923 
1924     protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1925     {
1926         String src = source.getUrl();
1927         if ( src != null )
1928         {
1929             if ( sourceDominant || target.getUrl() == null )
1930             {
1931                 target.setUrl( src );
1932                 target.setLocation( "url", source.getLocation( "url" ) );
1933             }
1934         }
1935     }
1936 
1937     protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1938     {
1939         String src = source.getConnection();
1940         if ( src != null )
1941         {
1942             if ( sourceDominant || target.getConnection() == null )
1943             {
1944                 target.setConnection( src );
1945                 target.setLocation( "connection", source.getLocation( "connection" ) );
1946             }
1947         }
1948     }
1949 
1950     protected void mergeScm_DeveloperConnection( Scm target, Scm source, boolean sourceDominant,
1951                                                  Map<Object, Object> context )
1952     {
1953         String src = source.getDeveloperConnection();
1954         if ( src != null )
1955         {
1956             if ( sourceDominant || target.getDeveloperConnection() == null )
1957             {
1958                 target.setDeveloperConnection( src );
1959                 target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) );
1960             }
1961         }
1962     }
1963 
1964     protected void mergeScm_Tag( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1965     {
1966         String src = source.getTag();
1967         if ( src != null )
1968         {
1969             if ( sourceDominant || target.getTag() == null )
1970             {
1971                 target.setTag( src );
1972                 target.setLocation( "tag", source.getLocation( "tag" ) );
1973             }
1974         }
1975     }
1976 
1977     protected void mergeCiManagement( CiManagement target, CiManagement source, boolean sourceDominant,
1978                                       Map<Object, Object> context )
1979     {
1980         mergeCiManagement_System( target, source, sourceDominant, context );
1981         mergeCiManagement_Url( target, source, sourceDominant, context );
1982         mergeCiManagement_Notifiers( target, source, sourceDominant, context );
1983     }
1984 
1985     protected void mergeCiManagement_System( CiManagement target, CiManagement source, boolean sourceDominant,
1986                                              Map<Object, Object> context )
1987     {
1988         String src = source.getSystem();
1989         if ( src != null )
1990         {
1991             if ( sourceDominant || target.getSystem() == null )
1992             {
1993                 target.setSystem( src );
1994                 target.setLocation( "system", source.getLocation( "system" ) );
1995             }
1996         }
1997     }
1998 
1999     protected void mergeCiManagement_Url( CiManagement target, CiManagement source, boolean sourceDominant,
2000                                           Map<Object, Object> context )
2001     {
2002         String src = source.getUrl();
2003         if ( src != null )
2004         {
2005             if ( sourceDominant || target.getUrl() == null )
2006             {
2007                 target.setUrl( src );
2008                 target.setLocation( "url", source.getLocation( "url" ) );
2009             }
2010         }
2011     }
2012 
2013     protected void mergeCiManagement_Notifiers( CiManagement target, CiManagement source, boolean sourceDominant,
2014                                                 Map<Object, Object> context )
2015     {
2016         List<Notifier> src = source.getNotifiers();
2017         if ( !src.isEmpty() )
2018         {
2019             List<Notifier> tgt = target.getNotifiers();
2020             Map<Object, Notifier> merged = new LinkedHashMap<Object, Notifier>( ( src.size() + tgt.size() ) * 2 );
2021 
2022             for ( Notifier element : tgt )
2023             {
2024                 Object key = getNotifierKey( element );
2025                 merged.put( key, element );
2026             }
2027 
2028             for ( Notifier element : src )
2029             {
2030                 Object key = getNotifierKey( element );
2031                 if ( sourceDominant || !merged.containsKey( key ) )
2032                 {
2033                     merged.put( key, element );
2034                 }
2035             }
2036 
2037             target.setNotifiers( new ArrayList<Notifier>( merged.values() ) );
2038         }
2039     }
2040 
2041     protected void mergeNotifier( Notifier target, Notifier source, boolean sourceDominant,
2042                                   Map<Object, Object> context )
2043     {
2044         mergeNotifier_Type( target, source, sourceDominant, context );
2045         mergeNotifier_Address( target, source, sourceDominant, context );
2046         mergeNotifier_Configuration( target, source, sourceDominant, context );
2047         mergeNotifier_SendOnError( target, source, sourceDominant, context );
2048         mergeNotifier_SendOnFailure( target, source, sourceDominant, context );
2049         mergeNotifier_SendOnSuccess( target, source, sourceDominant, context );
2050         mergeNotifier_SendOnWarning( target, source, sourceDominant, context );
2051     }
2052 
2053     protected void mergeNotifier_Type( Notifier target, Notifier source, boolean sourceDominant,
2054                                        Map<Object, Object> context )
2055     {
2056         String src = source.getType();
2057         if ( src != null )
2058         {
2059             if ( sourceDominant || target.getType() == null )
2060             {
2061                 target.setType( src );
2062             }
2063         }
2064     }
2065 
2066     protected void mergeNotifier_Address( Notifier target, Notifier source, boolean sourceDominant,
2067                                           Map<Object, Object> context )
2068     {
2069         String src = source.getAddress();
2070         if ( src != null )
2071         {
2072             if ( sourceDominant || target.getAddress() == null )
2073             {
2074                 target.setAddress( src );
2075             }
2076         }
2077     }
2078 
2079     protected void mergeNotifier_Configuration( Notifier target, Notifier source, boolean sourceDominant,
2080                                                 Map<Object, Object> context )
2081     {
2082         Properties merged = new Properties();
2083         if ( sourceDominant )
2084         {
2085             merged.putAll( target.getConfiguration() );
2086             merged.putAll( source.getConfiguration() );
2087         }
2088         else
2089         {
2090             merged.putAll( source.getConfiguration() );
2091             merged.putAll( target.getConfiguration() );
2092         }
2093         target.setConfiguration( merged );
2094     }
2095 
2096     protected void mergeNotifier_SendOnError( Notifier target, Notifier source, boolean sourceDominant,
2097                                               Map<Object, Object> context )
2098     {
2099         if ( sourceDominant )
2100         {
2101             target.setSendOnError( source.isSendOnError() );
2102         }
2103     }
2104 
2105     protected void mergeNotifier_SendOnFailure( Notifier target, Notifier source, boolean sourceDominant,
2106                                                 Map<Object, Object> context )
2107     {
2108         if ( sourceDominant )
2109         {
2110             target.setSendOnFailure( source.isSendOnFailure() );
2111         }
2112     }
2113 
2114     protected void mergeNotifier_SendOnSuccess( Notifier target, Notifier source, boolean sourceDominant,
2115                                                 Map<Object, Object> context )
2116     {
2117         if ( sourceDominant )
2118         {
2119             target.setSendOnSuccess( source.isSendOnSuccess() );
2120         }
2121     }
2122 
2123     protected void mergeNotifier_SendOnWarning( Notifier target, Notifier source, boolean sourceDominant,
2124                                                 Map<Object, Object> context )
2125     {
2126         if ( sourceDominant )
2127         {
2128             target.setSendOnWarning( source.isSendOnWarning() );
2129         }
2130     }
2131 
2132     protected void mergePrerequisites( Prerequisites target, Prerequisites source, boolean sourceDominant,
2133                                        Map<Object, Object> context )
2134     {
2135         mergePrerequisites_Maven( target, source, sourceDominant, context );
2136     }
2137 
2138     protected void mergePrerequisites_Maven( Prerequisites target, Prerequisites source, boolean sourceDominant,
2139                                              Map<Object, Object> context )
2140     {
2141         String src = source.getMaven();
2142         if ( src != null )
2143         {
2144             if ( sourceDominant || target.getMaven() == null )
2145             {
2146                 target.setMaven( src );
2147                 target.setLocation( "maven", source.getLocation( "maven" ) );
2148             }
2149         }
2150     }
2151 
2152     protected void mergeBuild( Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
2153     {
2154         mergeBuildBase( target, source, sourceDominant, context );
2155         mergeBuild_SourceDirectory( target, source, sourceDominant, context );
2156         mergeBuild_ScriptSourceDirectory( target, source, sourceDominant, context );
2157         mergeBuild_TestSourceDirectory( target, source, sourceDominant, context );
2158         mergeBuild_OutputDirectory( target, source, sourceDominant, context );
2159         mergeBuild_TestOutputDirectory( target, source, sourceDominant, context );
2160         mergeBuild_Extensions( target, source, sourceDominant, context );
2161     }
2162 
2163     protected void mergeBuild_SourceDirectory( Build target, Build source, boolean sourceDominant,
2164                                                Map<Object, Object> context )
2165     {
2166         String src = source.getSourceDirectory();
2167         if ( src != null )
2168         {
2169             if ( sourceDominant || target.getSourceDirectory() == null )
2170             {
2171                 target.setSourceDirectory( src );
2172                 target.setLocation( "sourceDirectory", source.getLocation( "sourceDirectory" ) );
2173             }
2174         }
2175     }
2176 
2177     protected void mergeBuild_ScriptSourceDirectory( Build target, Build source, boolean sourceDominant,
2178                                                      Map<Object, Object> context )
2179     {
2180         String src = source.getScriptSourceDirectory();
2181         if ( src != null )
2182         {
2183             if ( sourceDominant || target.getScriptSourceDirectory() == null )
2184             {
2185                 target.setScriptSourceDirectory( src );
2186                 target.setLocation( "scriptSourceDirectory", source.getLocation( "scriptSourceDirectory" ) );
2187             }
2188         }
2189     }
2190 
2191     protected void mergeBuild_TestSourceDirectory( Build target, Build source, boolean sourceDominant,
2192                                                    Map<Object, Object> context )
2193     {
2194         String src = source.getTestSourceDirectory();
2195         if ( src != null )
2196         {
2197             if ( sourceDominant || target.getTestSourceDirectory() == null )
2198             {
2199                 target.setTestSourceDirectory( src );
2200                 target.setLocation( "testSourceDirectory", source.getLocation( "testSourceDirectory" ) );
2201             }
2202         }
2203     }
2204 
2205     protected void mergeBuild_OutputDirectory( Build target, Build source, boolean sourceDominant,
2206                                                Map<Object, Object> context )
2207     {
2208         String src = source.getOutputDirectory();
2209         if ( src != null )
2210         {
2211             if ( sourceDominant || target.getOutputDirectory() == null )
2212             {
2213                 target.setOutputDirectory( src );
2214                 target.setLocation( "outputDirectory", source.getLocation( "outputDirectory" ) );
2215             }
2216         }
2217     }
2218 
2219     protected void mergeBuild_TestOutputDirectory( Build target, Build source, boolean sourceDominant,
2220                                                    Map<Object, Object> context )
2221     {
2222         String src = source.getTestOutputDirectory();
2223         if ( src != null )
2224         {
2225             if ( sourceDominant || target.getTestOutputDirectory() == null )
2226             {
2227                 target.setTestOutputDirectory( src );
2228                 target.setLocation( "testOutputDirectory", source.getLocation( "testOutputDirectory" ) );
2229             }
2230         }
2231     }
2232 
2233     protected void mergeBuild_Extensions( Build target, Build source, boolean sourceDominant,
2234                                           Map<Object, Object> context )
2235     {
2236         List<Extension> src = source.getExtensions();
2237         if ( !src.isEmpty() )
2238         {
2239             List<Extension> tgt = target.getExtensions();
2240             Map<Object, Extension> merged = new LinkedHashMap<Object, Extension>( ( src.size() + tgt.size() ) * 2 );
2241 
2242             for ( Extension element : tgt )
2243             {
2244                 Object key = getExtensionKey( element );
2245                 merged.put( key, element );
2246             }
2247 
2248             for ( Extension element : src )
2249             {
2250                 Object key = getExtensionKey( element );
2251                 if ( sourceDominant || !merged.containsKey( key ) )
2252                 {
2253                     merged.put( key, element );
2254                 }
2255             }
2256 
2257             target.setExtensions( new ArrayList<Extension>( merged.values() ) );
2258         }
2259     }
2260 
2261     protected void mergeExtension( Extension target, Extension source, boolean sourceDominant,
2262                                    Map<Object, Object> context )
2263     {
2264         mergeExtension_GroupId( target, source, sourceDominant, context );
2265         mergeExtension_ArtifactId( target, source, sourceDominant, context );
2266         mergeExtension_Version( target, source, sourceDominant, context );
2267     }
2268 
2269     protected void mergeExtension_GroupId( Extension target, Extension source, boolean sourceDominant,
2270                                            Map<Object, Object> context )
2271     {
2272         String src = source.getGroupId();
2273         if ( src != null )
2274         {
2275             if ( sourceDominant || target.getGroupId() == null )
2276             {
2277                 target.setGroupId( src );
2278                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
2279             }
2280         }
2281     }
2282 
2283     protected void mergeExtension_ArtifactId( Extension target, Extension source, boolean sourceDominant,
2284                                               Map<Object, Object> context )
2285     {
2286         String src = source.getArtifactId();
2287         if ( src != null )
2288         {
2289             if ( sourceDominant || target.getArtifactId() == null )
2290             {
2291                 target.setArtifactId( src );
2292                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
2293             }
2294         }
2295     }
2296 
2297     protected void mergeExtension_Version( Extension target, Extension source, boolean sourceDominant,
2298                                            Map<Object, Object> context )
2299     {
2300         String src = source.getVersion();
2301         if ( src != null )
2302         {
2303             if ( sourceDominant || target.getVersion() == null )
2304             {
2305                 target.setVersion( src );
2306                 target.setLocation( "version", source.getLocation( "version" ) );
2307             }
2308         }
2309     }
2310 
2311     protected void mergeBuildBase( BuildBase target, BuildBase source, boolean sourceDominant,
2312                                    Map<Object, Object> context )
2313     {
2314         mergePluginConfiguration( target, source, sourceDominant, context );
2315         mergeBuildBase_DefaultGoal( target, source, sourceDominant, context );
2316         mergeBuildBase_FinalName( target, source, sourceDominant, context );
2317         mergeBuildBase_Directory( target, source, sourceDominant, context );
2318         mergeBuildBase_Resources( target, source, sourceDominant, context );
2319         mergeBuildBase_TestResources( target, source, sourceDominant, context );
2320         mergeBuildBase_Filters( target, source, sourceDominant, context );
2321     }
2322 
2323     protected void mergeBuildBase_DefaultGoal( BuildBase target, BuildBase source, boolean sourceDominant,
2324                                                Map<Object, Object> context )
2325     {
2326         String src = source.getDefaultGoal();
2327         if ( src != null )
2328         {
2329             if ( sourceDominant || target.getDefaultGoal() == null )
2330             {
2331                 target.setDefaultGoal( src );
2332                 target.setLocation( "defaultGoal", source.getLocation( "defaultGoal" ) );
2333             }
2334         }
2335     }
2336 
2337     protected void mergeBuildBase_Directory( BuildBase target, BuildBase source, boolean sourceDominant,
2338                                              Map<Object, Object> context )
2339     {
2340         String src = source.getDirectory();
2341         if ( src != null )
2342         {
2343             if ( sourceDominant || target.getDirectory() == null )
2344             {
2345                 target.setDirectory( src );
2346                 target.setLocation( "directory", source.getLocation( "directory" ) );
2347             }
2348         }
2349     }
2350 
2351     protected void mergeBuildBase_FinalName( BuildBase target, BuildBase source, boolean sourceDominant,
2352                                              Map<Object, Object> context )
2353     {
2354         String src = source.getFinalName();
2355         if ( src != null )
2356         {
2357             if ( sourceDominant || target.getFinalName() == null )
2358             {
2359                 target.setFinalName( src );
2360                 target.setLocation( "finalName", source.getLocation( "finalName" ) );
2361             }
2362         }
2363     }
2364 
2365     protected void mergeBuildBase_Filters( BuildBase target, BuildBase source, boolean sourceDominant,
2366                                            Map<Object, Object> context )
2367     {
2368         List<String> src = source.getFilters();
2369         if ( !src.isEmpty() )
2370         {
2371             List<String> tgt = target.getFilters();
2372             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
2373             merged.addAll( tgt );
2374             merged.addAll( src );
2375             target.setFilters( merged );
2376         }
2377     }
2378 
2379     protected void mergeBuildBase_Resources( BuildBase target, BuildBase source, boolean sourceDominant,
2380                                              Map<Object, Object> context )
2381     {
2382         List<Resource> src = source.getResources();
2383         if ( !src.isEmpty() )
2384         {
2385             List<Resource> tgt = target.getResources();
2386             Map<Object, Resource> merged = new LinkedHashMap<Object, Resource>( ( src.size() + tgt.size() ) * 2 );
2387 
2388             for ( Resource element : tgt )
2389             {
2390                 Object key = getResourceKey( element );
2391                 merged.put( key, element );
2392             }
2393 
2394             for ( Resource element : src )
2395             {
2396                 Object key = getResourceKey( element );
2397                 if ( sourceDominant || !merged.containsKey( key ) )
2398                 {
2399                     merged.put( key, element );
2400                 }
2401             }
2402 
2403             target.setResources( new ArrayList<Resource>( merged.values() ) );
2404         }
2405     }
2406 
2407     protected void mergeBuildBase_TestResources( BuildBase target, BuildBase source, boolean sourceDominant,
2408                                                  Map<Object, Object> context )
2409     {
2410         List<Resource> src = source.getTestResources();
2411         if ( !src.isEmpty() )
2412         {
2413             List<Resource> tgt = target.getTestResources();
2414             Map<Object, Resource> merged = new LinkedHashMap<Object, Resource>( ( src.size() + tgt.size() ) * 2 );
2415 
2416             for ( Resource element : tgt )
2417             {
2418                 Object key = getResourceKey( element );
2419                 merged.put( key, element );
2420             }
2421 
2422             for ( Resource element : src )
2423             {
2424                 Object key = getResourceKey( element );
2425                 if ( sourceDominant || !merged.containsKey( key ) )
2426                 {
2427                     merged.put( key, element );
2428                 }
2429             }
2430 
2431             target.setTestResources( new ArrayList<Resource>( merged.values() ) );
2432         }
2433     }
2434 
2435     protected void mergePluginConfiguration( PluginConfiguration target, PluginConfiguration source,
2436                                              boolean sourceDominant, Map<Object, Object> context )
2437     {
2438         mergePluginContainer( target, source, sourceDominant, context );
2439         mergePluginConfiguration_PluginManagement( target, source, sourceDominant, context );
2440     }
2441 
2442     protected void mergePluginConfiguration_PluginManagement( PluginConfiguration target, PluginConfiguration source,
2443                                                               boolean sourceDominant, Map<Object, Object> context )
2444     {
2445         PluginManagement src = source.getPluginManagement();
2446         if ( src != null )
2447         {
2448             PluginManagement tgt = target.getPluginManagement();
2449             if ( tgt == null )
2450             {
2451                 tgt = new PluginManagement();
2452                 target.setPluginManagement( tgt );
2453             }
2454             mergePluginManagement( tgt, src, sourceDominant, context );
2455         }
2456     }
2457 
2458     protected void mergePluginContainer( PluginContainer target, PluginContainer source, boolean sourceDominant,
2459                                          Map<Object, Object> context )
2460     {
2461         mergePluginContainer_Plugins( target, source, sourceDominant, context );
2462     }
2463 
2464     protected void mergePluginContainer_Plugins( PluginContainer target, PluginContainer source,
2465                                                  boolean sourceDominant, Map<Object, Object> context )
2466     {
2467         List<Plugin> src = source.getPlugins();
2468         if ( !src.isEmpty() )
2469         {
2470             List<Plugin> tgt = target.getPlugins();
2471             Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
2472 
2473             for ( Plugin element : tgt )
2474             {
2475                 Object key = getPluginKey( element );
2476                 merged.put( key, element );
2477             }
2478 
2479             for ( Plugin element : src )
2480             {
2481                 Object key = getPluginKey( element );
2482                 if ( sourceDominant || !merged.containsKey( key ) )
2483                 {
2484                     merged.put( key, element );
2485                 }
2486             }
2487 
2488             target.setPlugins( new ArrayList<Plugin>( merged.values() ) );
2489         }
2490     }
2491 
2492     protected void mergePluginManagement( PluginManagement target, PluginManagement source, boolean sourceDominant,
2493                                           Map<Object, Object> context )
2494     {
2495         mergePluginContainer( target, source, sourceDominant, context );
2496     }
2497 
2498     protected void mergePlugin( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2499     {
2500         mergeConfigurationContainer( target, source, sourceDominant, context );
2501         mergePlugin_GroupId( target, source, sourceDominant, context );
2502         mergePlugin_ArtifactId( target, source, sourceDominant, context );
2503         mergePlugin_Version( target, source, sourceDominant, context );
2504         mergePlugin_Extensions( target, source, sourceDominant, context );
2505         mergePlugin_Dependencies( target, source, sourceDominant, context );
2506         mergePlugin_Executions( target, source, sourceDominant, context );
2507     }
2508 
2509     protected void mergePlugin_GroupId( Plugin target, Plugin source, boolean sourceDominant,
2510                                         Map<Object, Object> context )
2511     {
2512         String src = source.getGroupId();
2513         if ( src != null )
2514         {
2515             if ( sourceDominant || target.getGroupId() == null )
2516             {
2517                 target.setGroupId( src );
2518                 target.setLocation( "groupId", source.getLocation( "groupId" ) );
2519             }
2520         }
2521     }
2522 
2523     protected void mergePlugin_ArtifactId( Plugin target, Plugin source, boolean sourceDominant,
2524                                            Map<Object, Object> context )
2525     {
2526         String src = source.getArtifactId();
2527         if ( src != null )
2528         {
2529             if ( sourceDominant || target.getArtifactId() == null )
2530             {
2531                 target.setArtifactId( src );
2532                 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
2533             }
2534         }
2535     }
2536 
2537     protected void mergePlugin_Version( Plugin target, Plugin source, boolean sourceDominant,
2538                                         Map<Object, Object> context )
2539     {
2540         String src = source.getVersion();
2541         if ( src != null )
2542         {
2543             if ( sourceDominant || target.getVersion() == null )
2544             {
2545                 target.setVersion( src );
2546                 target.setLocation( "version", source.getLocation( "version" ) );
2547             }
2548         }
2549     }
2550 
2551     protected void mergePlugin_Extensions( Plugin target, Plugin source, boolean sourceDominant,
2552                                            Map<Object, Object> context )
2553     {
2554         String src = source.getExtensions();
2555         if ( src != null )
2556         {
2557             if ( sourceDominant || target.getExtensions() == null )
2558             {
2559                 target.setExtensions( src );
2560                 target.setLocation( "extensions", source.getLocation( "extensions" ) );
2561             }
2562         }
2563     }
2564 
2565     protected void mergePlugin_Dependencies( Plugin target, Plugin source, boolean sourceDominant,
2566                                              Map<Object, Object> context )
2567     {
2568         List<Dependency> src = source.getDependencies();
2569         if ( !src.isEmpty() )
2570         {
2571             List<Dependency> tgt = target.getDependencies();
2572             Map<Object, Dependency> merged = new LinkedHashMap<Object, Dependency>( ( src.size() + tgt.size() ) * 2 );
2573 
2574             for ( Dependency element : tgt )
2575             {
2576                 Object key = getDependencyKey( element );
2577                 merged.put( key, element );
2578             }
2579 
2580             for ( Dependency element : src )
2581             {
2582                 Object key = getDependencyKey( element );
2583                 if ( sourceDominant || !merged.containsKey( key ) )
2584                 {
2585                     merged.put( key, element );
2586                 }
2587             }
2588 
2589             target.setDependencies( new ArrayList<Dependency>( merged.values() ) );
2590         }
2591     }
2592 
2593     protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
2594                                            Map<Object, Object> context )
2595     {
2596         List<PluginExecution> src = source.getExecutions();
2597         if ( !src.isEmpty() )
2598         {
2599             List<PluginExecution> tgt = target.getExecutions();
2600 
2601             Map<Object, PluginExecution> merged =
2602                 new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
2603 
2604             for ( PluginExecution element : tgt )
2605             {
2606                 Object key = getPluginExecutionKey( element );
2607                 merged.put( key, element );
2608             }
2609 
2610             for ( PluginExecution element : src )
2611             {
2612                 Object key = getPluginExecutionKey( element );
2613                 if ( sourceDominant || !merged.containsKey( key ) )
2614                 {
2615                     merged.put( key, element );
2616                 }
2617             }
2618 
2619             target.setExecutions( new ArrayList<PluginExecution>( merged.values() ) );
2620         }
2621     }
2622 
2623     protected void mergeConfigurationContainer( ConfigurationContainer target, ConfigurationContainer source,
2624                                                 boolean sourceDominant, Map<Object, Object> context )
2625     {
2626         mergeConfigurationContainer_Inherited( target, source, sourceDominant, context );
2627         mergeConfigurationContainer_Configuration( target, source, sourceDominant, context );
2628     }
2629 
2630     protected void mergeConfigurationContainer_Inherited( ConfigurationContainer target, ConfigurationContainer source,
2631                                                           boolean sourceDominant, Map<Object, Object> context )
2632     {
2633         String src = source.getInherited();
2634         if ( src != null )
2635         {
2636             if ( sourceDominant || target.getInherited() == null )
2637             {
2638                 target.setInherited( src );
2639                 target.setLocation( "inherited", source.getLocation( "inherited" ) );
2640             }
2641         }
2642     }
2643 
2644     protected void mergeConfigurationContainer_Configuration( ConfigurationContainer target,
2645                                                               ConfigurationContainer source, boolean sourceDominant,
2646                                                               Map<Object, Object> context )
2647     {
2648         Xpp3Dom src = (Xpp3Dom) source.getConfiguration();
2649         if ( src != null )
2650         {
2651             Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration();
2652             if ( sourceDominant || tgt == null )
2653             {
2654                 tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt );
2655             }
2656             else
2657             {
2658                 tgt = Xpp3Dom.mergeXpp3Dom( tgt, src );
2659             }
2660             target.setConfiguration( tgt );
2661         }
2662     }
2663 
2664     protected void mergePluginExecution( PluginExecution target, PluginExecution source, boolean sourceDominant,
2665                                          Map<Object, Object> context )
2666     {
2667         mergeConfigurationContainer( target, source, sourceDominant, context );
2668         mergePluginExecution_Id( target, source, sourceDominant, context );
2669         mergePluginExecution_Phase( target, source, sourceDominant, context );
2670         mergePluginExecution_Goals( target, source, sourceDominant, context );
2671     }
2672 
2673     protected void mergePluginExecution_Id( PluginExecution target, PluginExecution source, boolean sourceDominant,
2674                                             Map<Object, Object> context )
2675     {
2676         String src = source.getId();
2677         if ( src != null )
2678         {
2679             if ( sourceDominant || target.getId() == null )
2680             {
2681                 target.setId( src );
2682                 target.setLocation( "id", source.getLocation( "id" ) );
2683             }
2684         }
2685     }
2686 
2687     protected void mergePluginExecution_Phase( PluginExecution target, PluginExecution source, boolean sourceDominant,
2688                                                Map<Object, Object> context )
2689     {
2690         String src = source.getPhase();
2691         if ( src != null )
2692         {
2693             if ( sourceDominant || target.getPhase() == null )
2694             {
2695                 target.setPhase( src );
2696                 target.setLocation( "phase", source.getLocation( "phase" ) );
2697             }
2698         }
2699     }
2700 
2701     protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
2702                                                Map<Object, Object> context )
2703     {
2704         List<String> src = source.getGoals();
2705         if ( !src.isEmpty() )
2706         {
2707             List<String> tgt = target.getGoals();
2708             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
2709             merged.addAll( tgt );
2710             merged.addAll( src );
2711             target.setGoals( merged );
2712         }
2713     }
2714 
2715     protected void mergeResource( Resource target, Resource source, boolean sourceDominant,
2716                                   Map<Object, Object> context )
2717     {
2718         mergeFileSet( target, source, sourceDominant, context );
2719         mergeResource_TargetPath( target, source, sourceDominant, context );
2720         mergeResource_Filtering( target, source, sourceDominant, context );
2721         mergeResource_MergeId( target, source, sourceDominant, context );
2722     }
2723 
2724     protected void mergeResource_TargetPath( Resource target, Resource source, boolean sourceDominant,
2725                                              Map<Object, Object> context )
2726     {
2727         String src = source.getTargetPath();
2728         if ( src != null )
2729         {
2730             if ( sourceDominant || target.getTargetPath() == null )
2731             {
2732                 target.setTargetPath( src );
2733                 target.setLocation( "targetPath", source.getLocation( "targetPath" ) );
2734             }
2735         }
2736     }
2737 
2738     protected void mergeResource_Filtering( Resource target, Resource source, boolean sourceDominant,
2739                                             Map<Object, Object> context )
2740     {
2741         String src = source.getFiltering();
2742         if ( src != null )
2743         {
2744             if ( sourceDominant || target.getFiltering() == null )
2745             {
2746                 target.setFiltering( src );
2747                 target.setLocation( "filtering", source.getLocation( "filtering" ) );
2748             }
2749         }
2750     }
2751 
2752     protected void mergeResource_MergeId( Resource target, Resource source, boolean sourceDominant,
2753                                           Map<Object, Object> context )
2754     {
2755         String src = source.getMergeId();
2756         if ( src != null )
2757         {
2758             if ( sourceDominant || target.getMergeId() == null )
2759             {
2760                 target.setMergeId( src );
2761             }
2762         }
2763     }
2764 
2765     protected void mergeFileSet( FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
2766     {
2767         mergePatternSet( target, source, sourceDominant, context );
2768         mergeFileSet_Directory( target, source, sourceDominant, context );
2769     }
2770 
2771     protected void mergeFileSet_Directory( FileSet target, FileSet source, boolean sourceDominant,
2772                                            Map<Object, Object> context )
2773     {
2774         String src = source.getDirectory();
2775         if ( src != null )
2776         {
2777             if ( sourceDominant || target.getDirectory() == null )
2778             {
2779                 target.setDirectory( src );
2780                 target.setLocation( "directory", source.getLocation( "directory" ) );
2781             }
2782         }
2783     }
2784 
2785     protected void mergePatternSet( PatternSet target, PatternSet source, boolean sourceDominant,
2786                                     Map<Object, Object> context )
2787     {
2788         mergePatternSet_Includes( target, source, sourceDominant, context );
2789         mergePatternSet_Excludes( target, source, sourceDominant, context );
2790     }
2791 
2792     protected void mergePatternSet_Includes( PatternSet target, PatternSet source, boolean sourceDominant,
2793                                              Map<Object, Object> context )
2794     {
2795         List<String> src = source.getIncludes();
2796         if ( !src.isEmpty() )
2797         {
2798             List<String> tgt = target.getIncludes();
2799             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
2800             merged.addAll( tgt );
2801             merged.addAll( src );
2802             target.setIncludes( merged );
2803         }
2804     }
2805 
2806     protected void mergePatternSet_Excludes( PatternSet target, PatternSet source, boolean sourceDominant,
2807                                              Map<Object, Object> context )
2808     {
2809         List<String> src = source.getExcludes();
2810         if ( !src.isEmpty() )
2811         {
2812             List<String> tgt = target.getExcludes();
2813             List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
2814             merged.addAll( tgt );
2815             merged.addAll( src );
2816             target.setExcludes( merged );
2817         }
2818     }
2819 
2820     protected void mergeProfile( Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2821     {
2822         mergeModelBase( target, source, sourceDominant, context );
2823         // TODO
2824     }
2825 
2826     protected void mergeActivation( Activation target, Activation source, boolean sourceDominant,
2827                                     Map<Object, Object> context )
2828     {
2829         // TODO
2830     }
2831 
2832     protected Object getDependencyKey( Dependency dependency )
2833     {
2834         return dependency;
2835     }
2836 
2837     protected Object getPluginKey( Plugin object )
2838     {
2839         return object;
2840     }
2841 
2842     protected Object getPluginExecutionKey( PluginExecution object )
2843     {
2844         return object;
2845     }
2846 
2847     protected Object getReportPluginKey( ReportPlugin object )
2848     {
2849         return object;
2850     }
2851 
2852     protected Object getReportSetKey( ReportSet object )
2853     {
2854         return object;
2855     }
2856 
2857     protected Object getLicenseKey( License object )
2858     {
2859         return object;
2860     }
2861 
2862     protected Object getMailingListKey( MailingList object )
2863     {
2864         return object;
2865     }
2866 
2867     protected Object getDeveloperKey( Developer object )
2868     {
2869         return object;
2870     }
2871 
2872     protected Object getContributorKey( Contributor object )
2873     {
2874         return object;
2875     }
2876 
2877     protected Object getProfileKey( Profile object )
2878     {
2879         return object;
2880     }
2881 
2882     protected Object getRepositoryKey( Repository object )
2883     {
2884         return getRepositoryBaseKey( object );
2885     }
2886 
2887     protected Object getRepositoryBaseKey( RepositoryBase object )
2888     {
2889         return object;
2890     }
2891 
2892     protected Object getNotifierKey( Notifier object )
2893     {
2894         return object;
2895     }
2896 
2897     protected Object getResourceKey( Resource object )
2898     {
2899         return object;
2900     }
2901 
2902     protected Object getExtensionKey( Extension object )
2903     {
2904         return object;
2905     }
2906 
2907     protected Object getExclusionKey( Exclusion object )
2908     {
2909         return object;
2910     }
2911 
2912 }