问题
If I do an mvn site:effective-site
on my parent I get this:
<project>
<bannerLeft>
<name>xxx :: Open Source Parent POM</name>
</bannerLeft>
<publishDate />
<version />
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.5</version>
</skin>
<body>
<menu ref="parent" />
<menu ref="reports" />
</body>
</project>
However, if I do it on a child project I get this:
<project>
<bannerLeft>
<name>xxx :: Parent</name>
</bannerLeft>
<publishDate />
<version />
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.5</version>
</skin>
<body />
</project>
Here's my site_en.xml thats in the same project as the parent pom
<project>
<body>
<menu ref="parent" />
<menu ref="modules" />
<menu ref="reports" />
</body>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.5</version>
</skin>
</project>
Here's my pom structure for that project
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.myorg</groupId>
<artifactId>oss-parent</artifactId>
<packaging>pom</packaging>
<version>6-SNAPSHOT</version>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<attach>true</attach>
</configuration>
</plugin>
</plugins>
</build>
Here's the subproject pom that's not inheriting the body:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myorg</groupId>
<artifactId>oss-parent</artifactId>
<version>6-SNAPSHOT</version>
</parent>
...
<artifactId>my-project</artifactId>
...
</project>
What gives? Surely I'm not the only one that needs a site template for their whole enterprise!
回答1:
<body>
<menu ref="parent" inherit="bottom"/>
<menu ref="reports" inherit="bottom"/>
<menu ref="modules" inherit="bottom"/>
</body>
This helped, if set in parent pom's site.xml. Explicit inheritance settings are apparently required, at least in site plugin v.3.7.
来源:https://stackoverflow.com/questions/37583106/maven-site-plugin-body-tag-is-not-being-inherited