Guest User

Untitled

a guest
Nov 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. 1. profile放在不同位置的相互覆盖关系. ( 1. 子pom; 2. 父pom; 3. profile.xml )
  2. 2. profile是局部覆盖还是全部覆盖.
  3.  
  4.  
  5. TC1. 只在父properties中配置
  6. 设定:
  7. super properties: foo=bar_in_parent_properties
  8. 输出:
  9. super.xml:
  10. <property name='foo' value='bar_in_parent_properties'/>
  11. sub.xml:
  12. <property location="sub_module" name='foo' value='bar_in_parent_properties'/>
  13. 结论:
  14. 子模块继承了父类的properties
  15.  
  16. TC2. 在子pom中添加同样的properties
  17.  
  18. 设定:
  19. super properties: foo=bar_in_parent_properties
  20. sub properties: foo=bar_in_sub_pom_properties
  21.  
  22. 输出:
  23. super.xml:
  24. <property location="super" name='foo' value='bar_in_parent_properties'/>
  25. sub.xml:
  26. <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/>
  27. 结论:
  28. 子模块中的同名属性可以覆盖父POM的属性
  29.  
  30. TC3. 在父pom中添加一个profile,并启用
  31.  
  32. 设定:
  33. super properties: <foo>bar_in_parent_properties</foo>
  34. sub properties: <foo>bar_in_sub_pom_properties</foo>
  35. super profile properties: <foo>bar_in_parent_profile</foo>
  36. 输出:
  37. super.xml:
  38. <property location="super" name='foo' value='bar_in_parent_profile'/>
  39. sub.xml:
  40. <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/>
  41. 结论:
  42. 父类profile中的属性生效
  43.  
  44. TC4. 在子POM中添加另外一个profile,并启用
  45.  
  46. 设定:
  47. super properties: <foo>bar_in_parent_properties</foo>
  48. sub properties: <foo>bar_in_sub_pom_properties</foo>
  49. super profile properties: <foo>bar_in_parent_profile</foo> # in super profile
  50. sub profile properties: <foo>foo_in_sub_profile</foo> # in sub profile
  51. 输出:
  52. super.xml
  53. <property location="super" name='foo' value='bar_in_parent_profile'/> #父profile中的属性
  54. sub.xml
  55. <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/> # 子profile中的属性
  56.  
  57. TC5. 将子POM中的profile重命名为与父POM同名
  58. 设定:
  59. super properties: <foo>bar_in_parent_properties</foo>
  60. sub properties: <foo>bar_in_sub_pom_properties</foo>
  61. super profile properties: <foo>bar_in_parent_profile</foo> # in super profile
  62. sub profile properties: <foo>foo_in_sub_profile</foo> # in sub profile
  63. 输出:
  64. super.xml
  65. <property location="super" name='foo' value='bar_in_parent_profile'/> #父profile中的属性
  66. sub.xml
  67. <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/> #父profile中的属性
  68. 结论:
  69. 都在各自的scope生效
  70.  
  71. TC6. 同名的profile是合并properties还是完全覆盖?
  72.  
  73. 设定:
  74. 在super profile中添加一个属性'bar'
  75. 输出:
  76. super.xml:
  77. <property location="super" name='foo' value='bar_in_parent_profile'/>
  78. <property location="super" name='val' value='val_in_parent_profile'/>
  79. sub.xml:
  80. <property location="sub_module" name='foo' value='bar_in_sub_pom_properties'/>
  81. <property location="sub_module" name='val' value='val_in_parent_profile'/>
  82.  
  83. 结论:
  84. 子类实际生效的properties合并.
  85.  
  86. TC7. 在子POM中添加一个不同名的属性
  87.  
  88. 设定:
  89.  
  90. 输出:
  91. super.xml:
  92. <property location="super" name='foo' value='bar_in_parent_profile'/>
  93. <property location="super" name='val' value='val_in_parent_profile'/>
  94. sub.xml
  95. <property location="sub_module" name='foo' value='foo_in_sub_profile'/>
  96. <property location="sub_module" name='val' value='val_in_sub_profile'/>
  97. <property location="sub_module" name='only_in_sub' value='foo_only_in_sub'/>
  98.  
  99.  
  100.  
  101.  
  102. 总结:
  103. *) 根据不同scope,范围越小优先级越高.子module覆盖父module
  104. *) 生效的profile中的properties会覆盖默认的properties
  105. *) 同名的profile其实没有影响,子POM中会继承覆盖(合并)
Add Comment
Please, Sign In to add comment