Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. profile放在不同位置的相互覆盖关系. ( 1. 子pom; 2. 父pom; 3. profile.xml )
- 2. profile是局部覆盖还是全部覆盖.
- TC1. 只在父properties中配置
- 设定:
- super properties: foo=bar_in_parent_properties
- 输出:
- super.xml:
- <property name='foo' value='bar_in_parent_properties'/>
- sub.xml:
- <property location="sub_module" name='foo' value='bar_in_parent_properties'/>
- 结论:
- 子模块继承了父类的properties
- TC2. 在子pom中添加同样的properties
- 设定:
- super properties: foo=bar_in_parent_properties
- sub properties: foo=bar_in_sub_pom_properties
- 输出:
- super.xml:
- <property location="super" name='foo' value='bar_in_parent_properties'/>
- sub.xml:
- <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/>
- 结论:
- 子模块中的同名属性可以覆盖父POM的属性
- TC3. 在父pom中添加一个profile,并启用
- 设定:
- super properties: <foo>bar_in_parent_properties</foo>
- sub properties: <foo>bar_in_sub_pom_properties</foo>
- super profile properties: <foo>bar_in_parent_profile</foo>
- 输出:
- super.xml:
- <property location="super" name='foo' value='bar_in_parent_profile'/>
- sub.xml:
- <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/>
- 结论:
- 父类profile中的属性生效
- TC4. 在子POM中添加另外一个profile,并启用
- 设定:
- super properties: <foo>bar_in_parent_properties</foo>
- sub properties: <foo>bar_in_sub_pom_properties</foo>
- super profile properties: <foo>bar_in_parent_profile</foo> # in super profile
- sub profile properties: <foo>foo_in_sub_profile</foo> # in sub profile
- 输出:
- super.xml
- <property location="super" name='foo' value='bar_in_parent_profile'/> #父profile中的属性
- sub.xml
- <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/> # 子profile中的属性
- TC5. 将子POM中的profile重命名为与父POM同名
- 设定:
- super properties: <foo>bar_in_parent_properties</foo>
- sub properties: <foo>bar_in_sub_pom_properties</foo>
- super profile properties: <foo>bar_in_parent_profile</foo> # in super profile
- sub profile properties: <foo>foo_in_sub_profile</foo> # in sub profile
- 输出:
- super.xml
- <property location="super" name='foo' value='bar_in_parent_profile'/> #父profile中的属性
- sub.xml
- <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/> #父profile中的属性
- 结论:
- 都在各自的scope生效
- TC6. 同名的profile是合并properties还是完全覆盖?
- 设定:
- 在super profile中添加一个属性'bar'
- 输出:
- super.xml:
- <property location="super" name='foo' value='bar_in_parent_profile'/>
- <property location="super" name='val' value='val_in_parent_profile'/>
- sub.xml:
- <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/>
- <property location="sub_module" name='val' value='val_in_parent_profile'/>
- 结论:
- 子类实际生效的properties合并.
- TC7. 在子POM中添加一个不同名的属性
- 设定:
- 输出:
- super.xml:
- <property location="super" name='foo' value='bar_in_parent_profile'/>
- <property location="super" name='val' value='val_in_parent_profile'/>
- sub.xml
- <property location="sub_module" name='foo' value='foo_in_sub_profile'/>
- <property location="sub_module" name='val' value='val_in_sub_profile'/>
- <property location="sub_module" name='only_in_sub' value='foo_only_in_sub'/>
- 总结:
- *) 根据不同scope,范围越小优先级越高.子module覆盖父module
- *) 生效的profile中的properties会覆盖默认的properties
- *) 同名的profile其实没有影响,子POM中会继承覆盖(合并)
Add Comment
Please, Sign In to add comment