Type: New Feature
Affects Version/s: 2.0-beta-7
Fix Version/s: None
Number of attachments :
Inheritance of menus in an multimodule project environment does not work as intuitively expected (as in OO languages). The following excerpts try to illustrate this. Assume there is a root project R that has one module (project) S. Both contain a site descriptor. Let the site descriptor for R be as follows:
And let the site descriptor for S be:
As I'm used to the way inheritance and polymorphism are defined in OO languages such as Java, I would expect the following properties for the "Main" menu in S:
- item "Introduction" is overwritten in S but refers to the same index.html file; of course, its path is relative to start directory of S
- item "News" is missing for S but will be inherited from R, thus, it will be rendered to the site as in R
- item "Overwrite" is overwritten in S and refers now to overwrite.html (instead of documentation.html as in R)
- item "Added" is new in S, thus, it will be rendered to the site in addition
Unfortunately, with the current implementation of the site plugin inheritance is as follows:
- "Main" menu of R is inherited by S as-is, that is, all changes made to the menu in S are not visible/rendered to the site.
I would like to propose to implement polymorphism regarding menu inheritance as described above. In addition, I would like to propose a new boolean parameter "inherited" (or "inherit") that can be added to menu items. Its semantics would be equivalent to the "inherited" tag in pom.xml. In the following one example for R:
With this example only menu item "News 2" would appear in S because its inheritance is not disabled, while menu item "News 1" appears only in R and not in S because its inheritance was disabled (false). The default if the parameter is missing should be "true".
Btw, the same extension should be made to the <menu ... > tag to allow to enable or disable inheritance of menus entirely.