maven-javadoc-plugin target-directory of aggregate

2019-09-16 09:51发布

问题:

I have an issue concerning the target directory of aggregated javadocs.

What I have is:

A maven project containing several modules. It looks a bit like the one used as example here

Project
  |-- directory_to_contain_docs/
  |-- pom.xml
  |-- Module1
  |   `-- pom.xml
  |-- Module2
  |   `-- pom.xml
  `-- Module3
    `-- pom.xml

I can't get it done to make javadoc generate the documentation in the directory named "directory_to_contain_docs".

This is what I tried:

I call the generation with "mvn javadoc:aggregate". And this is a part of the pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <configuration>
                <!-- Default configuration for all reports -->
                <failOnError>false</failOnError>

                <destDir>${basedir}/directory_to_contain_docs</destDir>
                <!-- as there are lots of incorrectly documented sources -->
                <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
            <executions>
                <execution>
                    <id>aggregate</id>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                    <phase>site</phase>
                    <configuration>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

The javadoc is always generated in {project}/target/site/apidocs, the generation creates the complete path given in destDir beneath that directory. I am looking for a way to have the whole docs somewhere else.

Is there a chance to achieve that?

Thanks, Ishiido

回答1:

Don't know why I did not see it... The missing link is configuration/reportOutputDirectory. It specifies the directory where the documentation is generated. It may be specified further by destDir.