Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven site (Maven 3) generates empty site folder

I'm attempting to create a basic maven site using the maven site plugin. So I added this to my pom:

<reporting>
    <plugins>
        <!--JavaDoc setup-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <defaultAuthor>Leon Blakey</defaultAuthor>
                <defaultVersion>${project.version}</defaultVersion>
                <links>
                    <link>http://download.oracle.com/javase/6/docs/api</link>
                </links>
            </configuration>
        </plugin>
    </plugins>
</reporting>

And ran mvn site --errors

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pircbotx 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:2.0.1:site (default-site) @ pircbotx ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.688s
[INFO] Finished at: Wed Jan 12 18:08:00 EST 2011
[INFO] Final Memory: 5M/13M
[INFO] ------------------------------------------------------------------------
W:\programming\pircbot-hg>

Hmm, odd that there's no output. So when I check target/site, its empty. The only folders are images/ , css/ , and WEB-INF/ , filled with some generic pictures. No javadoc and no site.

This is reproducible with mvn site:site and mvn org.apache.maven.plugins:maven-site-plugin:2.2:site (apparently maven only wants to use 2.0.1 by default)

Whats strange is that I can go back to maven 2.2.1 and successfully generate a site. But when I use 3.0.1-RC1 (happens to come with Netbeans), it fails.

What am I doing wrong that would make the site plugin fail in 3.0.1 but not 2.2.1?

like image 609
TheLQ Avatar asked Jan 12 '11 23:01

TheLQ


People also ask

What is site generation in Maven?

The Site Plugin is used to generate a site for the project. The generated site also includes the project's reports that were configured in the POM. Please read the migration guide if you want to upgrade from a previous version.

What does MVN site command do?

To view the generated site on a local machine, run mvn site:run. This command will deploy the site to a Jetty web server at the address localhost:8080. The run goal of this plugin isn't implicitly bound to a phase in the site lifecycle, hence we need to call it directly.

Why Maven takes much time for 1st execution and from 2nd execution it will take less time?

Depending on how many dependencies (and its dependencies, called indirect dependencies) your project has it will download all plus the needed dependencies for maven plugins itself. The ones configured in your project and the ones for the normal goals you are executing.

What is groupId and artifactId in Maven?

groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project.


2 Answers

Perhaps you can try using Maven Site Plugin 3.x. You can do that by adding the following in your pom.xml

<build>
    ...
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0-beta-3</version>
        </plugin>
    </plugins>
</build>
like image 54
Raghuram Avatar answered Oct 05 '22 22:10

Raghuram


I was having the same problem. I found a blog post about the topic.

Quoting the blog (emphasis mine):

If you have been using the reporting section of the pom.xml file to generate code quality metrics, javadoc reports, and so forth, you may have a little work to do to migrate this feature into Maven 3. Indeed, the reporting and reportSets sections have been deprecated (it won't cause an error with Maven 3, it will just be ignored), and have been replaced by a reportPlugins section in the configuration block of the maven-site-plugin itself.

Ignoring the old <reporting> without any warning about it being deprecated seems a bit rude, but anyway...

So you are basically just moving your old reporting plugins into the configuration section of the new maven-site-plugin.

A section of the maven-plugin-site explains that they removed of all reporting logic from the core of Maven to "decouple the Maven core from Doxia and to allow arbitrary reporting systems to be developed." Makes sense.

like image 37
MrDrews Avatar answered Oct 05 '22 23:10

MrDrews