Maven的站点生成不起作用

发布于 2024-10-29 12:00:03 字数 171 浏览 7 评论 0原文

有人没有得到 mvn 站点输出吗?我在 Macbook pro 上获得了站点输出,并且我也部署了该站点。但今晚没有任何效果:

[INFO] --- maven-site-plugin:2.0.1:site (default-cli) @ svs-utility ---

没有生成报告或 HTML

Anyone not getting mvn site output? I was getting site output on my Macbook pro and I have deployed the site too. But tonight nothing works:

[INFO] --- maven-site-plugin:2.0.1:site (default-cli) @ svs-utility ---

No reports or HTML generated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哭了丶谁疼 2024-11-05 12:00:03

我认为根据 Raghuram 的建议,你已经弄清楚了,但是,我今天看到了这个问题,我也遇到了同样的问题。我正在学习 Maven,我想在这里记录我的步骤,因为它可能对其他人有用。我正在运行 Maven 3.0.1,它使用的插件版本 2.0.1 不起作用。

我在 stackoverflow 上发现了另一个问题,解释了如何升级 Maven插件。

正如@andri所说:

默认插件版本是
继承自Super POM,而你
可以用 mvn 检查它们
帮助:有效的pom。

我检查了一下,确实使用的是 2.0.1 - 我在 http://search.maven.org/ 对于网站插件的最新版本,在撰写本文时是 3.0-beta-3(UPDATE 3.0 已发布,我更新了下面的代码)。

然而,@andri 答案没有报告超级 POM 中的正确结构,而 @Brian Fox 答案则报告了正确的结构。结合这两个答案和 Maven 存储库中找到的信息,我将以下内容添加到我的 pom.xml

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

通过此更改,“mvn site”现在可以工作了。

现在有人可能会问,为什么 Maven 3 附带了一个不起作用的插件。事实证明,Maven 开发人员 Brian Fox 决定 将插件锁定到版本 2。一般来说,这对于稳定性来说似乎是一个好主意,但是由于不尊重向后兼容性,因此在这种特定情况下它变成了一个非常糟糕的主意。 super pom 中的插件应该可以在其打包版本中开箱即用。要么应提供向后兼容性,要么应更新到新版本。

也许稍后会修复它,同时上述解决方法有效。将插件的版本锁定到特定项目也是一个好主意。

I think that with Raghuram advice you've already figured out, however, I saw this question today and I had the same problem. I'm learning Maven and I thought to document my steps here since it may be useful to someone else. I'm running Maven 3.0.1 and it was using version 2.0.1 of the plugin which doesn't work.

I found another question on stackoverflow explaining how to upgrade a Maven plugin.

As @andri said:

The default plugin versions are
inherited from the Super POM, and you
can check them with mvn
help:effective-pom.

I checked and it was indeed using 2.0.1 - I searched on http://search.maven.org/ for the latest version of site plugin and at the time of writing is 3.0-beta-3 (UPDATE 3.0 is out, I've updated the code below).

However @andri answer doesn't report the correct structure as in the super POM, while @Brian Fox answer does. Combining the two answers and the info found in the Maven repo, I added the following to my pom.xml

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

With this change "mvn site" now works.

Now someone might ask, why Maven 3 ships with a plugin that doesn't work. It turns out that Brian Fox, a Maven developer has decided to lock down plugins to version 2. In general this seems a good idea for stability, however since backward compatibility is not honored, it becomes a very bad idea in this specific case. A plugin in super pom should work out of the box for the version it's packaged for. Either backward compatibility should be provided or it should be updated to the new version.

Maybe it will be fixed later, in the meantime the above workaround works. It's also a good idea to lock down the version of the plugin to the specific project.

阳光下的泡沫是彩色的 2024-11-05 12:00:03

你用的是maven 3吗?如果是这样,您需要使用 3.x 版本

Are you using maven 3? If so, you need to use the 3.x version of the site plugin

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文