Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do my generated Javadocs look terrible?

I'm trying to generate the Javadoc HTML files for my project. I'm generating them via the Maven Javadoc plugin (maven-javadoc-plugin). I am using Maven 2.2.1. Everything generates such that all the proper information is there, but the HTML looks just awful. So bad that I don't want to publish it that way. Here is a screenshot:

(NOTE: Yes, I see the 'JavaScript is disabled on your browser' message. Even if I click the IE 8 warning about active content and enable it, it makes no difference)

Screenshot of messed up Javadoc formatting

There are all kinds of unnecessary line breaks, and the basic formatting is just crap. Am I missing something? I was expecting to see generated Javadocs that look similar to what I see in Eclipse if I hover over a class or method and see the popup Javadoc panel.

I've tried adding setting in my POM file, but I really don't know what I'm doing when it comes to configuring the Javadoc generator. Here's what I have at the moment (inside the <reporting> element):

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <configuration>
        <javadocExecutable>C:\Java\jdk1.7.0_05\bin\javadoc.exe</javadocExecutable>
        <javadocVersion>1.7</javadocVersion>
        <locale>en_US</locale>
        <show>package</show>
        <verbose />
    </configuration>
</plugin>

Any suggestions?


UPDATE:

The solution provided by Paulius worked perfectly. I removed the section above from my <reporting> section, as it was totally unnecessary. I added the new <plugin> element as he specified below. My POM file now contains this new block:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8.1</version>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>           
        ...
    </plugins>
</build>

Here is what the fixed output looks like:

Properly generated Javadoc

like image 697
Jim Tough Avatar asked Oct 24 '12 12:10

Jim Tough


1 Answers

Try to remove maven-javadoc-plugin from reporting section. If you are using Maven 3, the reporting section is deprecated and should be removed.

Try to add the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8.1</version>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

to your maven plugins section and run it. I am using maven-javadoc-plugin like this and it generates normal javadocs.

Hope this helps.

like image 107
Paulius Matulionis Avatar answered Sep 19 '22 10:09

Paulius Matulionis