Maven:无法创建 Javadoc [英] Maven: Can not create Javadocs

查看:46
本文介绍了Maven:无法创建 Javadoc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在我喜欢的文件夹中创建 javadoc,这是我的 javadoc 插件的样子;

I can not create javadocs to a folder I like, Here is how my javadoc plugin looks like;

 <build>

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <configuration>
                <outputDirectory>${build.dir}/resources/javadoc</outputDirectory>
                <reportOutputDirectory>${project.reporting.outputDirectory}/javadoc</reportOutputDirectory>
            </configuration>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <phase>package</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

有什么想法吗?

EDIT MAven install 导致错误"

EDIT MAven install leads to error"

Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:aggregate
  (attach-javadocs) on project priTool: An error has occurred in JavaDocs report     generation:
 [ERROR] Exit code: 1 -            C:\pricing\priWebApp\src\main\..webapp\backend\local\PriUpgradeHelper.java:5:
 package       ..upgrademanager does not exist
[ERROR] import ...upgrademanager.ComponentInfo;

升级管理器是一个外部依赖,但我可以在库中看到它的 jar

Upgrade Manager is an external dependency, but I can see its jar in library

推荐答案

您需要了解 mvn packagemvn install 之间的区别.package 在 Maven 项目/模块的 target 文件夹中创建 JAR.

You need to understand the difference between mvn package and mvn install. package creates the JARs in the target folder of the Maven project/module.

如果有更多模块,他们将无法看到这些 JAR - 对于每个项目/模块,Maven 查看本地存储库以解决依赖关系,即使可以在同一个项目.

If there are more modules, they won't be able to see these JARs - for each project/module, Maven only looks into the local repository to resolve dependencies, even if could resolve them in the same project.

这就是 install 所做的:打包 JAR,然后将它们安装到本地存储库中.

And that's what install does: Package the JARs and then install them into the local repository.

如果您有一个 Maven 项目,其中包含多个模块(又名反应堆构建),那么永远不要使用 mvn package.始终使用mvn install.

When you have a Maven project, with several modules (a.k.a a reactor build), then never use mvn package. Always use mvn install.

这篇关于Maven:无法创建 Javadoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆