maven-site plugins 3.3 java.lang.ClassNotFoundException: org.apache.maven.doxia.siterenderer.DocumentContent

Since this night, maven site 3.3 plugins stop to work.

Try to delete local repository, but no change. Maven 3.3.9 java 1.8

No config or dependencies defined in pom for site plugins

[WARNING] Error injecting: org.apache.maven.report.projectinfo.CiManagementReport
java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent
86960 次浏览

你真的需要添加更多的信息(顺便说一句,我没有否决)。

如果您没有为绑定到生命周期阶段的插件指定一个版本,您将获得最新版本。

试试:

  • 升级到最新版本的 maven-3.5.4 ATOW
  • 运行 mvn help:effective-pom并检查哪些版本是 实际上正在解决-如果你有一个来自 CI 或任何地方的旧日志 来比较. 。
  • 显式设置 maven-site-plugin版本 在 pluginManagement部分
  • Adding a dependency to maven-site-plugin (see below)

org/apache/maven/doxia/siterenderer/DocumentContent can be found in doxia-site-renderer:

    <dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>1.8.1</version>
</dependency>

我怀疑显式地将 maven-site-plugin 的版本设置为您过去使用的任何版本(顺便说一句)都可以工作。


编辑: 在 maven 插件构建测试中遇到了类似的问题,在 maven-invoker-plugin使用的集成框架中显式设置 maven-site-plugin版本(3.7.1 ATOW)对我来说很有效。

I had just started to get this issue also during builds. What worked for me was to specifically define the maven-site-plugin and the maven-project-info-reports-plugin along with the version numbers in the pom.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>

这是由于 maven-project-info-reports-plugin更新到3.0.0,依赖于 doxia-site-renderer1.8(并且有 org.apache.maven.doxia.siterenderer.DocumentContent这个类) ,但是 maven-site-plugin:3.3依赖于 doxia-site-renderer:1.4(并且没有 org.apache.maven.doxia.siterenderer.DocumentContent)

我们可以在 reporting部分详细介绍 maven-project-info-reports-plugin版本:

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
</plugin>
</plugins>
</reporting>

或者我们可以将 maven-site-plugin指定为最新的3.7.1,比如:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>

in build part of pom.

我今天在一些构建作业中也遇到了这个错误。上面建议的修复方法,为 maven-site-plugin 添加一个具体的依赖项,确实有效,并且修复了这个问题。

然而,它突出了我的事实,我甚至正在运行 mvn 站点的目标,我甚至不知道我们正在运行,我们并不真正需要。

我的解决方案是从我的 mvn 参数中删除站点目标,因为尽管它创建的站点实际上非常有用,但我从不知道我们正在创建它,我们从未在任何地方发布它,而且实际上每次构建都会删除它。

我试图遵循彰化的建议,在我的 pom 文件中将 maven-project-info-reports-plugin 定义为3.0.0版本,将 maven-site-plugin 定义为3.7.1版本,但发现 maven 网站仍然使用了 maven-site-plugin 的3.3版本,不管我如何设置它。

我终于意识到我的问题和我们的项目结构有关。我们有一个父 pom,其中我们定义了 maven-site-plugin 依赖关系,然后由子 pom 继承。然而,build pom 文件是独立的,根本没有定义 maven-site-plugin,这使得 maven 可以自己引入3.3版本。我将 maven-site-plugin 依赖项(版本3.7.1)添加到构建 pom 文件中,因此它现在同时存在于构建 pom 文件和父 pom 文件中,现在构建正确使用版本3.7.1,并且正在再次传递。

Maven 站点插件的版本也需要在构建部分显式设置:

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>licenses</report>
<report>dependency-info</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>


<build>
<plugins>
<!-- Part of Maven - specified version explicitly for compatibility
with the maven-project-info-reports-plugin 3.0.0-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
</plugins>
</build>

Maven 3不再支持 Doxia 了。

使用

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
</plugin>

参考资料: https://maven.apache.org/plugins/maven-site-plugin/maven-3.html

Xml 中的以下版本为我解决了这个问题:

            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
</plugin>