Class DefaultProfileInjector
- java.lang.Object
-
- org.apache.maven.project.injection.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.
-
-
Field Summary
-
Fields inherited from interface org.apache.maven.project.injection.ProfileInjector
ROLE
-
-
Constructor Summary
Constructors Constructor Description DefaultProfileInjector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
inject(Profile profile, Model model)
private void
injectBuild(Profile profile, Model model)
private void
injectConfigurationContainer(ConfigurationContainer profileContainer, ConfigurationContainer modelContainer)
private java.util.List
injectDependencies(java.util.List profileDeps, java.util.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)
-
-
-
Method Detail
-
inject
public void inject(Profile profile, Model model)
- Specified by:
inject
in interfaceProfileInjector
-
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 DOMrecessive
- Recessive DOM- Returns:
- Merged DOM
-
injectConfigurationContainer
private void injectConfigurationContainer(ConfigurationContainer profileContainer, ConfigurationContainer modelContainer)
-
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)
-
mergeReportPlugins
private void mergeReportPlugins(ReportPlugin dominant, ReportPlugin recessive)
-
injectDependencies
private java.util.List injectDependencies(java.util.List profileDeps, java.util.List modelDeps)
-
-