简体   繁体   English

Maven JavaDoc:缺少必需的类

[英]Maven JavaDoc: Required Class Missing

I'm running Maven 3.0 and have cleared out my repository, then rebuilt the repository. 我正在运行Maven 3.0并清除了我的存储库,然后重建了存储库。 When I use "mvn clean install" I get a successful build, but no JavaDocs created. 当我使用“mvn clean install”时,我获得了成功的构建,但没有创建JavaDocs。 But when I use "mvn javadoc:aggregate", I get this error. 但是当我使用“mvn javadoc:aggregate”时,我收到了这个错误。 I loaded Maven Reporting (3.0) and am still getting this error, even after adding reporting to the dependencies. 我加载了Maven Reporting(3.0),即使在向依赖项添加报告之后,我仍然会收到此错误。 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" “无法在插件中加载mojo'javadoc''org.apache.maven-javadoc-plugin-2.8'缺少必需的类:org / apache / maven / reporting / MavenReport”

BTW, is there an easy way to get a properly formatted XML file in a code block? 顺便说一下,有一种简单的方法可以在代码块中获得格式正确的XML文件吗?

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

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). 几天前我也遇到过这个问题:它是由报告的JAR破坏造成的(我想在我身边它是由一个这样疯狂的DNS服务器引起的,一些ISP提供的每个请求都以虚拟HTML页面发送给客户端)。

Deleting the maven reporting plugin from the local M2 cache and letting Maven to download it again solved the issue for me. 从本地M2缓存中删除maven报告插件并让Maven再次下载它解决了我的问题。

Deleting full .m2 local repository solved my problem. 删除完整的.m2本地存储库解决了我的问题。

Or else you need to know what plugins are you using exactly with their dependencies, as one of the plugin suffered a problem while downloading. 或者你需要知道你正在使用哪些插件与他们的依赖关系,因为其中一个插件在下载时遇到了问题。

In this case reporting, and assembly plugin deletion should do the trick. 在这种情况下报告和组装插件删除应该做的伎俩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM