Unable to configure alternate Javadoc output directory#1325
Open
pbaumard wants to merge 2 commits into
Open
Conversation
…put directory & Using Alternate Output Directory page is missing from docs
slachiewicz
approved these changes
Jun 7, 2026
There was a problem hiding this comment.
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
destDirparameter (defaultapidocs) and use it when computing report/jar output paths and intra-report links. - Update unit tests and test resources to cover custom
destDirusage and an “invalid destDir” scenario. - Add the missing
output-configurationexample 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> |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1305
Closes #1300
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
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.