Class DefaultProfileInjector

  • All Implemented Interfaces:
    ProfileInjector

    public class DefaultProfileInjector
    extends java.lang.Object
    implements ProfileInjector
    Inject profile data into a Model, using the profile as the dominant data source, and persisting results of the injection in the Model. This will look similar to the ModelUtils/DefaultModelInheritanceAssembler code, but they are distinct. In model inheritance, the child provides data dominance AND persists the results of the merge...sort of a 'merge-out' system. In this system, the profile is dominant, but the model receives the merge result...sort of a 'merge-in' system. The two pieces of code look like they could be combined with a set of flags to determine which direction to merge 'to', but there are enough differences in the code to justify the extra code involved with separating them, in order to simplify the logic.
    • Constructor Detail

      • DefaultProfileInjector

        public DefaultProfileInjector()
    • Method Detail

      • injectBuild

        private void injectBuild​(Profile profile,
                                 Model model)
      • injectPlugins

        protected void injectPlugins​(PluginContainer profileContainer,
                                     PluginContainer modelContainer)
        This should be the resulting ordering of plugins after injection: Given: model: X -> A -> B -> D -> E profile: Y -> A -> C -> D -> F Result: X -> Y -> A -> B -> C -> D -> E -> F
      • injectPluginDefinition

        private void injectPluginDefinition​(Plugin profilePlugin,
                                            Plugin modelPlugin)
      • merge

        private org.codehaus.plexus.util.xml.Xpp3Dom merge​(org.codehaus.plexus.util.xml.Xpp3Dom dominant,
                                                           org.codehaus.plexus.util.xml.Xpp3Dom recessive)
        Merge two DOMs. Copy the dominant DOM so the original one is left unchanged.

        Use this method instead of a direct call to Xpp3Dom.mergeXpp3Dom(Xpp3Dom, Xpp3Dom). Profiles are dominant, thus they are merge targets, but they may be merged in several times (e.g. if they are inherited). So with the second merge, you don't get the profile's original DOM, but an already merged one.

        Parameters:
        dominant - Dominant DOM
        recessive - Recessive DOM
        Returns:
        Merged DOM
      • injectModules

        private void injectModules​(Profile profile,
                                   Model model)
        Append modules specified in the profile to the end of the list supplied by the model, if they don't already exist.
      • injectDistributionManagement

        private void injectDistributionManagement​(Profile profile,
                                                  Model model)
      • injectDependencyManagement

        private void injectDependencyManagement​(Profile profile,
                                                Model model)
      • injectReporting

        private void injectReporting​(Profile profile,
                                     Model model)
      • injectDependencies

        private java.util.List injectDependencies​(java.util.List profileDeps,
                                                  java.util.List modelDeps)