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

JavaMaven

Java Problem Overview


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

Java Solutions


Solution 1 - Java

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>

Solution 2 - Java

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)

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

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

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

in build part of pom.

Solution 3 - Java

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

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

Solution 4 - Java

Maven 3 doesn't support Doxia anymore.

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

Solution 5 - Java

You really need to add more information (I didn't downvote 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.4 ATOW
  • Running mvn help:effective-pom and 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-plugin version in pluginManagement section
  • 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>

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


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

Solution 6 - Java

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.

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.

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.

Solution 7 - Java

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.

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.

Solution 8 - Java

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

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questiontimmy otoolView Question on Stackoverflow
Solution 1 - JavaDavidView Answer on Stackoverflow
Solution 2 - JavaChanghuaView Answer on Stackoverflow
Solution 3 - JavaTheJeffView Answer on Stackoverflow
Solution 4 - JavardsView Answer on Stackoverflow
Solution 5 - JavaearcamView Answer on Stackoverflow
Solution 6 - JavapsfView Answer on Stackoverflow
Solution 7 - JavambreckView Answer on Stackoverflow
Solution 8 - JavaSergey BondarevView Answer on Stackoverflow