Class DefaultProfileInjector
java.lang.Object
org.apache.maven.project.injection.DefaultProfileInjector
- All Implemented Interfaces:
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.
-
Field Summary
Fields inherited from interface org.apache.maven.project.injection.ProfileInjector
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
private void
injectBuild
(Profile profile, Model model) private void
injectConfigurationContainer
(ConfigurationContainer profileContainer, ConfigurationContainer modelContainer) private List
injectDependencies
(List profileDeps, List modelDeps) private void
injectDependencyManagement
(Profile profile, Model model) private void
injectDistributionManagement
(Profile profile, Model model) 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.private void
injectPluginDefinition
(Plugin profilePlugin, Plugin modelPlugin) 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 -> Fprivate void
injectReporting
(Profile profile, Model model) 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.private void
mergeReportPlugins
(ReportPlugin dominant, ReportPlugin recessive)
-
Constructor Details
-
DefaultProfileInjector
public DefaultProfileInjector()
-
-
Method Details
-
inject
- Specified by:
inject
in interfaceProfileInjector
-
injectBuild
-
injectPlugins
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
-
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 DOMrecessive
- Recessive DOM- Returns:
- Merged DOM
-
injectConfigurationContainer
private void injectConfigurationContainer(ConfigurationContainer profileContainer, ConfigurationContainer modelContainer) -
injectModules
Append modules specified in the profile to the end of the list supplied by the model, if they don't already exist. -
injectDistributionManagement
-
injectDependencyManagement
-
injectReporting
-
mergeReportPlugins
-
injectDependencies
-