让Maven从mvn包运行Javadoc:javadoc

时间:2013-10-07 14:38:50

标签: java maven configuration

我已配置javadoc i Maven,但我必须执行 mvn javadoc:javadoc 我执行 mvn package 时,我喜欢Maven。

我的pom看起来像

<plugin>
    <artifactId>maven-javadoc-plugin</artifactId>
     <version>${maven-javadoc-plugin.version}</version>
    <configuration>
        <aggregate>true</aggregate>
    </configuration>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>package</goal>
            </goals>
        </execution>
    </executions>
</plugin>

1 个答案:

答案 0 :(得分:1)

您的插件配置显示在相位prepare-package中调用了javadoc插件。因此,如果您调用mvn package,则会执行此插件。但是javadoc插件没有目标包:see plugin info here

我想你想调用javadoc的目标:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <configuration>
                ...
            </configuration>
            <executions>
                <execution>
                    <id>generate-javadoc</id>
                    <phase>package</phase>
                    <goals>
                        <goal>javadoc</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>