7

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

4

1 に答える 1

2

セクションから削除してみてmaven-javadoc-pluginくださいreporting。Maven 3 を使用している場合、レポート セクションは非推奨であり、削除する必要があります。

以下を追加してみてください。

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

あなたのmavenpluginsセクションに移動して実行します。私はmaven-javadoc-pluginこのように使用しており、通常のjavadocを生成します。

お役に立てれば。

于 2012-10-24T13:10:21.720 に答える