maven-site-plugin:标签未被继承

时间:2016-06-02 05:09:15

标签: java maven maven-site-plugin

如果我在父母身上做mvn site:effective-site,我就明白了:

<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>

但是,如果我在儿童项目上这样做,我会得到这个:

<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>

这是我的site_en.xml,与父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>

这是我项目的pom结构

<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>

这里的子项目pom没有继承身体:

<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>

是什么给出的?当然,我并不是唯一一个需要整个企业的网站模板的人!

1 个答案:

答案 0 :(得分:2)

<body>
    <menu ref="parent" inherit="bottom"/>
    <menu ref="reports" inherit="bottom"/>
    <menu ref="modules" inherit="bottom"/>
</body>

如果在父pom的site.xml中设置,这会有所帮助。显然需要显式继承设置,至少在站点插件v.3.7中是必需的。