Search code examples
pluginsmavenjavadoc

Maven JavaDoc: Required Class Missing


I'm running Maven 3.0 and have cleared out my repository, then rebuilt the repository. When I use "mvn clean install" I get a successful build, but no JavaDocs created. But when I use "mvn javadoc:aggregate", I get this error. I loaded Maven Reporting (3.0) and am still getting this error, even after adding reporting to the dependencies. I tried deleting the configuration section and versions as suggested by another question/answer but still have the same problem.

"Unable to load the mojo 'javadoc' in the plugin 'org.apache.maven-javadoc-plugin-2.8' A required class is missing: org/apache/maven/reporting/MavenReport"

BTW, is there an easy way to get a properly formatted XML file in a code block?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>groupid</groupId>
    <artifactId>D</artifactId>
    <version>1.0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>D</name>
    <description>Parent POM XML File</description>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <profiles>
        <profile>
            <activation>
                <jdk>[1.3,1.6)</jdk>
            </activation>
        </profile>
    </profiles>
    <modules>
        <module>One</module>
        <module>Two</module>
        <module>Three</module>
        <module>Four</module>
        <module>Five</module>
        <module>Six</module>
        <module>Seven</module>
        <module>Eight</module>
        <module>Nine</module>
        <module>Ten</module>
        <module>Eleven</module>
        <module>Twelve</module>
        <module>Thirteen</module>
    </modules>
    <dependencies>
        <dependency>
            <groupId>org.apache.abdera</groupId>
            <artifactId>abdera-bundle</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <type>jar</type>
            <optional>false</optional>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.1.5.1</version>
        </dependency>
        <dependency>
            <groupId>commonj</groupId>
            <artifactId>commonj</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.reporting</groupId>
            <artifactId>maven-reporting-api</artifactId>
            <version>3.0</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>D</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <outputDirectory>${project.build.directory}/javadoc</outputDirectory>
                    <reportOutputDirectory>${project.reporting.outputDirectory}/javadoc</reportOutputDirectory>
                    <version>2.8</version>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Solution

  • I had this issue also some days ago: It was caused by a broken JAR of reporting (I guess at my side it was caused by one this crazy DNS-servers some ISPs provide where every request ends in a dummy HTML page send to the client).

    Deleting the maven reporting plugin from the local M2 cache and letting Maven to download it again solved the issue for me.