Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven's site generation is not working

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

like image 433
David L. Whitehurst Avatar asked Dec 09 '22 09:12

David L. Whitehurst


1 Answers

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.

like image 87
stivlo Avatar answered Dec 28 '22 02:12

stivlo