maven-site-plugin:配置哪个页面应该是 index.html

maven-site-plugin: Configure which page should be the index.html

我已经按照以下方式配置了 maven-site-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.3</version>
    <configuration>
        <skip>${maven.site.plugin.skip}</skip>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-module-markdown</artifactId>
            <version>1.3</version>
        </dependency>
    </dependencies>
</plugin>

site.xml 看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
    <publishDate format="yyyy-MM-dd" position="right" />
    <version position="right" />

    <skin>
        <groupId>org.apache.maven.skins</groupId>
        <artifactId>maven-fluido-skin</artifactId>
        <version>1.4</version>
    </skin>

    <custom>
        <fluidoSkin>
            <gitHub>
                <projectId>siom79/japicmp</projectId>
                <ribbonOrientation>right</ribbonOrientation>
                <ribbonColor>gray</ribbonColor>
            </gitHub>
        </fluidoSkin>
    </custom>

    <body>
        <links>
            <item name="Maven" href="http://maven.apache.org/"/>
        </links>
        <breadcrumbs>
            <item name="japicmp" href="https://siom79.github.io/japicmp"/>
        </breadcrumbs>
        <menu name="Overview">
            <item href="Introduction.html" name="Introduction" />
            <item href="CliTool.html" name="CliTool" />
            <item href="MavenPlugin.html" name="MavenPlugin" />
            <item href="Examples.html" name="Examples" />
        </menu>
        <menu ref="reports" inherit="bottom" />
    </body>
</project>

但是当我 运行 mvn site:sitemvn site:stage 时 index.html 是关于页面。如何配置 index.html 获取 Introduction.html 页面?

该页面由 org.apache.maven.plugins:maven-project-info-reports-plugin:index 生成,但根据可用参数,您无法更改文件名。 你可以做的是创建你自己的 src/site/xdox/index.xml,包含 reload/redirect 到 Introduction.html 或者只是将 Introduction.html 重命名为 index.html,就像大家期望的那样。

同时我找到了答案。只需让 link Introduction 指向文件 index.html 并在文件夹 src/site/markdown 内将文件 Introduction.md 重命名为 index.md

    <menu name="Overview">
        <item href="index.html" name="Introduction"/>
        <item href="CliTool.html" name="CliTool" />
        <item href="MavenPlugin.html" name="MavenPlugin" />
        <item href="Examples.html" name="Examples" />
    </menu>