Skip to content

Unable to configure alternate Javadoc output directory#1325

Open
pbaumard wants to merge 2 commits into
apache:masterfrom
pbaumard:bugfix/alternate-output-directory
Open

Unable to configure alternate Javadoc output directory#1325
pbaumard wants to merge 2 commits into
apache:masterfrom
pbaumard:bugfix/alternate-output-directory

Conversation

@pbaumard

@pbaumard pbaumard commented May 19, 2026

Copy link
Copy Markdown

Closes #1305
Closes #1300

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

…put directory & Using Alternate Output Directory page is missing from docs
@slachiewicz slachiewicz added the enhancement New feature or request label Jun 7, 2026
@slachiewicz slachiewicz requested a review from Copilot June 7, 2026 18:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reintroduces support for configuring the Javadoc output subdirectory via destDir (to avoid hard-coding apidocs), and restores the missing “alternate output directory” documentation page.

Changes:

  • Add destDir parameter (default apidocs) and use it when computing report/jar output paths and intra-report links.
  • Update unit tests and test resources to cover custom destDir usage and an “invalid destDir” scenario.
  • Add the missing output-configuration example page back into the plugin site sources.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java Introduces destDir parameter and threads it through output-path/link logic.
src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java Uses destDir for report output paths.
src/main/java/org/apache/maven/plugins/javadoc/TestJavadocReport.java Uses destDir when linking test report back to main report.
src/site/apt/examples/output-configuration.apt.vm Restores the missing “Using Alternative Output Directory” documentation page.
src/test/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojoTest.java Adjusts unit test setup for the new destDir field.
src/test/java/org/apache/maven/plugins/javadoc/JavadocJarMojoTest.java Adds a test for invalid destDir handling.
src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java Updates expectations to match customized destDir.
src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml Adds destDir to a unit test project configuration.
src/test/resources/unit/javadocjar-invalid-destdir/javadocjar-invalid-destdir-plugin-config.xml Adds a new unit test project for invalid destDir.
src/test/resources/unit/javadocjar-invalid-destdir/javadocjar/invalid/destdir/App.java New test source for the invalid-destDir unit project.
src/test/resources/unit/javadocjar-invalid-destdir/javadocjar/invalid/destdir/AppSample.java New test source for the invalid-destDir unit project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 5781 to +5789
String url = cleanUrl(project.getUrl());
String destDir = "apidocs"; // see AbstractJavadocMojo#destDir
final String pluginId = "org.apache.maven.plugins:maven-javadoc-plugin";
String destDirConfigured = getPluginParameter(project, pluginId, "destDir");
if (destDirConfigured != null) {
destDir = destDirConfigured;
}

return url + "/apidocs";
return url + "/" + destDir;
Comment on lines +1676 to +1682
/**
* The name of the destination directory.
*
* @since 2.1
*/
@Parameter(property = "destDir", defaultValue = "apidocs")
protected String destDir;
Comment on lines +143 to +151
void testInvalidDestdir(JavadocJarMojo mojo) throws Exception {
mojo.execute();

// check if the javadoc jar file was generated
File generatedFile = new File(
getBasedir(),
"target/test/unit/javadocjar-invalid-destdir/target/javadocjar-invalid-destdir-javadoc.jar");
assertThat(generatedFile).doesNotExist();
}
Comment on lines +36 to +40
<destDir>${basedir}/target/test/unit/javadocjar-invalid-destdir/target/invalid</destDir>
<jarOutputDirectory>${basedir}/target/test/unit/javadocjar-invalid-destdir/target</jarOutputDirectory>
<outputDirectory>${basedir}/target/test/unit/javadocjar-invalid-destdir/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/javadocjar-invalid-destdir/target/javadoc-bundle-options</javadocOptionsDir>
<finalName>javadocjar-invalid-destdir</finalName>
Comment thread src/site/apt/examples/output-configuration.apt.vm Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to configure alternate Javadoc output directory Using Alternate Output Directory page is missing from docs

3 participants