Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public AbstractJavadocMojo(
* Detect the links for all modules defined in the project.
* <br/>
* If {@code reactorProjects} is defined in a non-aggregator way, it generates default offline links
* between modules based on the defined project's urls. For instance, if a parent project has two projects
* between modules based on the defined project's URLs. For instance, if a parent project has two projects
* <code>module1</code> and <code>module2</code>, the <code>-linkoffline</code> will be:
* <br/>
* The added Javadoc <code>-linkoffline</code> parameter for <b>module1</b> will be
Expand Down Expand Up @@ -5331,6 +5331,10 @@ private String getFullJavadocGoal() {
return sb.toString();
}

protected boolean isDetectOfflineLinks() {
return detectOfflineLinks;
}

/**
* Using Maven, a Javadoc link is given by <code>${project.url}/apidocs</code>.
*
Expand All @@ -5343,7 +5347,7 @@ private String getFullJavadocGoal() {
*/
private List<OfflineLink> getModulesLinks() throws MavenReportException {
List<MavenProject> aggregatedProjects = reactorProjects;
if (!detectOfflineLinks || isAggregator() || aggregatedProjects.isEmpty()) {
if (!isDetectOfflineLinks() || isAggregator() || aggregatedProjects.isEmpty()) {
return Collections.emptyList();
}

Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/apache/maven/plugins/javadoc/JavadocJarMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,25 @@ public JavadocJarMojo(
@Parameter(property = "maven.javadoc.classifier", defaultValue = "javadoc", required = true)
private String classifier;

/**
* Detect the links for all modules defined in the project.
* <br/>
Copy link
Contributor

Choose a reason for hiding this comment

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

* If {@code reactorProjects} is defined in a non-aggregator way, it generates default offline links
* between modules based on the defined project's URLs. For instance, if a parent project has two projects
* <code>module1</code> and <code>module2</code>, the <code>-linkoffline</code> will be:
* <br/>
Copy link
Contributor

Choose a reason for hiding this comment

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

* The added Javadoc <code>-linkoffline</code> parameter for <b>module1</b> will be
* <code>/absolute/path/to/</code><b>module2</b><code>/target/site/apidocs</code>
* <br/>
Copy link
Contributor

Choose a reason for hiding this comment

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

* The added Javadoc <code>-linkoffline</code> parameter for <b>module2</b> will be
* <code>/absolute/path/to/</code><b>module1</b><code>/target/site/apidocs</code>
*
* @see #offlineLinks
* @since 2.6
*/
@Parameter(property = "detectOfflineLinks", defaultValue = "false")
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this here instead of the superclass?

Copy link
Member Author

@olamy olamy Aug 26, 2025

Choose a reason for hiding this comment

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

because the role of this change is to have a default of false for *jar* mojos and leave parent as true

private boolean detectOfflineLinks;

/** {@inheritDoc} */
@Override
protected void doExecute() throws MojoExecutionException {
Expand Down Expand Up @@ -290,4 +309,9 @@ private File generateArchive(File javadocFiles, String jarFileName) throws Archi

return outputFile;
}

@Override
public boolean isDetectOfflineLinks() {
return detectOfflineLinks;
}
}
Loading