Maven 站点插件 3.3 java.lang.ClassNotFoundException: org.apache.maven.doxia.siterenderer.DocumentContent

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51091539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:56:51  来源:igfitidea点击:

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

javamaven

提问by timmy otool

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

从今晚开始,Maven 站点 3.3 插件停止工作。

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

尝试删除本地存储库,但没有更改。Maven 3.3.9 Java 1.8

No config or dependencies defined in pom for site plugins

在 pom 中没有为站点插件定义配置或依赖项

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

采纳答案by David

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

我刚开始在构建过程中也遇到这个问题。对我有用的是在 pom.xml 文件中专门定义 themaven-site-plugin和 themaven-project-info-reports-plugin以及版本号。

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

回答by earcam

You really need to add more information (I didn't downvote BTW).

你真的需要添加更多信息(我没有贬低BTW)。

IIRC; if you don't specify a version for a plugin bound to lifecycle phases, you'll get the latest.

国际研究中心;如果您没有为绑定到生命周期阶段的插件指定版本,您将获得最新版本。

Try:

尝试:

  • Upgrading to the latest version of maven - 3.5.4ATOW
  • Running mvn help:effective-pomand checking which versions are actually being resolved - if you have an old log from CI or wherever to compare with..
  • Explicity setting the maven-site-pluginversion in pluginManagementsection
  • Adding a dependency to maven-site-plugin(see below)
  • 升级到最新版本的 maven - 3.5.4ATOW
  • 运行mvn help:effective-pom并检查实际解决了哪些版本 - 如果您有来自 CI 或其他地方的旧日志可以与之比较..
  • maven-site-pluginpluginManagement节中显式设置版本
  • 添加依赖项maven-site-plugin(见下文)

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

org/apache/maven/doxia/siterenderer/DocumentContent可以在doxia-site-renderer

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

I suspect explicitly setting the version of maven-site-plugin to whatever you used to use (incidentally) will work.

我怀疑将 maven-site-plugin 的版本明确设置为您曾经使用的任何版本(顺便说一句)都可以。



Edit:Was chasing a similar issue in maven plugin build testing, explicitly setting maven-site-pluginversion (3.7.1 ATOW) in integration pom used by maven-invoker-pluginhas worked for me.

编辑:在 maven 插件构建测试中遇到类似的问题,在maven-site-plugin使用的集成 pom 中明确设置版本(3.7.1 ATOW)maven-invoker-plugin对我有用。

回答by Changhua

This is caused by maven-project-info-reports-plugin updated to 3.0.0, and rely on doxia-site-renderer 1.8 (and have org.apache.maven.doxia.siterenderer.DocumentContent this class), but maven-site-plugin:3.3 rely on doxia-site-renderer:1.4 (and do not have org.apache.maven.doxia.siterenderer.DocumentContent)

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

We can specific maven-project-info-reports-plugin version in reporting part:

我们可以在报告部分指定 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>

Or we can specify maven-site-plugin to the latest 3.7.1 like:

或者我们可以将 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

在 pom 的构建部分

回答by psf

I also hit this error on some of my build jobs today. The fix suggested above, adding a concrete dependency for the maven-site-plugin does work and fixes this issue.

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

However, what it highlighted for me was the fact I was even running the mvn site goal, which I didn't even know we were running and we don't really require.

然而,它对我来说强调的是我什至在运行 mvn 站点目标,我什至不知道我们正在运行并且我们并不真正需要它。

My fix was to therefore remove the site goal from my mvn arg, as although the site it creates is actually quite useful, I never knew we were creating it, we never published it anywhere and were actually deleting it every build anyway.

因此,我的解决方法是从我的 mvn arg 中删除站点目标,尽管它创建的站点实际上非常有用,但我从不知道我们正在创建它,我们从未将它发布到任何地方,并且实际上在每次构建时都将其删除。

回答by mbreck

I tried to follow Changhua's advice, and define maven-project-info-reports-plugin to version 3.0.0, and maven-site-plugin to 3.7.1 in my pom file, but found that the maven site still pulled in version 3.3 of the maven-site-plugin, regardless of how I set it.

我尝试按照彰化的建议,在我的pom文件中将maven-project-info-reports-plugin定义为3.0.0版本,将maven-site-plugin定义为3.7.1,但发现maven站点仍然拉入了3.3版本的 maven-site-plugin,无论我如何设置。

I finally realized that my problem had to do with our project structure. We have a parent pom, in which we were defining the maven-site-plugin dependency, which was then inherited by the children poms. However, the build pom file was separate, and didn't define maven-site-plugin at all, which allowed maven to pull in the 3.3 version on its own. I added the maven-site-plugin dependency (version 3.7.1) to the build pom file, so that it now exists in both the build pom file and the parent pom file, and now the build is correctly using version 3.7.1, and is passing again.

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

回答by TheJeff

Version of the maven site plugin needs to be explicitly set in the build section too. Here is the example:

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>

回答by rds

Maven 3 doesn't support Doxia anymore.

Maven 3 不再支持 Doxia。

Use

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

Reference: https://maven.apache.org/plugins/maven-site-plugin/maven-3.html

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

回答by Sergey Bondarev

The following versions in pom.xml fixed the problem for me:

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