Question

I'm trying to configure an alternate output location for the JavaDocs in my multi-module maven project. I configured the maven-javadoc in the parent POM to look like this:

<build>
...
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <configuration>
        <noqualifier>all</noqualifier>
        <reportOutputDirectory>
            ${project.reporting.outputDirectory}/api
        </reportOutputDirectory>
        <destDir>api</destDir>
    </configuration>
</plugin>
...
</build>

And then here is where I set the project.reporting.outputDirectory.

<properties>
    <project.reporting.outputDirectory>
        ./module-webapp/src/main/webapp/docs
    </project.reporting.outputDirectory>
</properties>

However, Maven doesn't seem to care for the above configuration, and is outputting the JavaDoc in the default directory notwithstanding. Why is this?

Also, I used a relative path for my project.reporting.outputDirectory variable. Will this relative path mean the same thing when I run mvn javadoc:javadoc in the sub-modules as when I run it in the parent module?

Thanks in advance... much appreciated!

Was it helpful?

Solution

You need to change the name of your variable. project.reporting.outputDirectory is a built-in variable and maven is overriding your setting of it.

Note that you might still need to set the directory relative to project.reporting.outputDirectory, or something like ${basedir} to actually get this to work.

Also keep in mind, based on my reading of the documentation, your final directory will be ./module-webapp/src/main/webapp/docs/api/api, which may not be exactly what you want

as far as relative directories and submodules go, each build tends to be self-contained, so it will deposit javadocs relative to each sub build.

OTHER TIPS

Found out what was wrong. For some reason, when I remove ${project.reporting.outputDirectory} and type in the path directly, it works. For some other reason, when I use any other variable name (other than the above) it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top