Eclipse javadoc 不能生成API文档解决

在Eclipse (Version: Mars Release (4.5.0) Build id: 20150621-1200)中,发现Maven项目通过Export或Project->Generate JavaDoc命令均不能生成API文档,而Java项目则可以。不得已,只好使用Maven工具来生成JavaDoc文档。步骤如下:

1、pom.xml配置

在<build>节加入javaDoc插件:

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-javadoc-plugin</artifactId>

                <version>2.8</version>

                <!-- 配置导出配置 -->

                <configuration>

                    <outputDirectory>target\javadoc</outputDirectory>

                    <reportOutputDirectory>target\javadoc</reportOutputDirectory>

                </configuration>

                <executions>

                    <execution>

                        <id>attach-javadocs</id>

                        <phase>site</phase>

                        <goals>

                            <goal>aggregate</goal>

                        </goals>

                    </execution>

                </executions>

            </plugin>          

 

2、运行生成JavaDoc的命令

在控制台执行下面的命令:

mvn javadoc:javadoc

或者点项目右键->Run as->Maven build...,在构建目标栏输入:javadoc:javadoc,最后点"Run",也可以生成API文档。

通过上述2步,即可顺利地生成

posted @ 2017-05-31 09:43  hongweigg  阅读(10)  评论(0编辑  收藏  举报