134

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
timmy otool
  • 1,353
  • 2
  • 8
  • 4
  • Possible duplicate of [Why maven doesn't generate project reports?](https://stackoverflow.com/questions/4112346/why-maven-doesnt-generate-project-reports) – rds Aug 29 '18 at 12:34

8 Answers8

181

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>
Michael
  • 41,989
  • 11
  • 82
  • 128
David
  • 5,203
  • 2
  • 16
  • 17
94

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.

Lii
  • 11,553
  • 8
  • 64
  • 88
Changhua
  • 986
  • 5
  • 6
  • This is actually the real cause. I was wondering what (or better who) triggered this to update? Where does maven get this information from? – ChristopherS Jun 29 '18 at 11:30
  • 1
    @mbreck yes, we need to add config to every pom. – Changhua Jul 02 '18 at 01:45
  • 1
    the maven-site-plugin version needs to be specified in the projects plugin section to work. The "new" reports section has confused me a lot and seems to be redundant. For me maven is close to unusable these days. – Wolfgang Fahl Aug 19 '18 at 05:48
  • This worked perfectly for me. I defined `maven-checkstyle-plugin (3.0.0)` and `maven-project-info-reports-plugin (2.9)` in the `` section of `pom.xml` – user2490003 Aug 23 '18 at 21:19
  • 2
    It worked for me only after downgrading maven-project-info-reports-plugin to v2.9, even though I have used maven-site-plugin v3.7.1 – Elayamathy Feb 02 '19 at 16:36
  • As already reported you need to downgrade to v2.9 even if maven-site is already at 3.7.1. Please update your answer. – Dave Moten Jul 27 '19 at 22:31
  • @DaveMoten I need to check again, but when I post the answers, I test two methods. and make sure, you need to add config to every pom including parent pom. – Changhua Aug 29 '19 at 03:00
21

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>
TheJeff
  • 3,665
  • 34
  • 52
  • 2
    Thank you! Was getting the error while following Maven's Getting Started guide and executing "mvn site". After adding your snippet to my pom.xml, command works now. – AbstractVoid Oct 21 '18 at 17:36
  • 1
    @WallTearer that was exactly the case. I don't know if it has a different behavior following the tutorials typing in the console or in Eclipse (it shouldn't I guess). Anyway, I guess the user guide should be updated. – foxTox Nov 26 '18 at 13:53
  • TheJeff is the man. I guess that it is the `` vs `` separation that made it work for me. – javabeangrinder Jun 05 '19 at 05:41
5

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

rds
  • 26,253
  • 19
  • 107
  • 134
2

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.

earcam
  • 6,662
  • 4
  • 37
  • 57
2

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>
Sergey Bondarev
  • 410
  • 4
  • 7
1

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.

psf
  • 138
  • 1
  • 2
  • 8
1

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.

mbreck
  • 121
  • 1
  • 4