Skip to content

Fail Gradle build whenever a javadoc task fails #34837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sbrannen opened this issue Apr 27, 2025 · 1 comment
Closed

Fail Gradle build whenever a javadoc task fails #34837

sbrannen opened this issue Apr 27, 2025 · 1 comment
Assignees
Labels
type: task A general task
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Apr 27, 2025

Overview

Changes made in conjunction with #27497 caused the aggregated Javadoc not to be generated/published.

However, we were quite surprised that such an error did not fail our Gradle build.

During the release process for Spring Framework 7.0.0-M4, the javadoc task in the Gradle build actually stated that there was an error, but the task finished successfully, which is why we did not notice that the Javadoc had not been published.

> Task :framework-api:javadoc
error: invalid flag: --link-modularity-mismatch
1 error
Usage:
    javadoc [options] [packagenames] [sourcefiles] [@files]

...

BUILD SUCCESSFUL ...

It turns out that the Gradle javadoc task does "fail on error" by default.

However, the io.freefair.aggregate-javadoc Gradle plugin from the FreeFair project configures the javadoc task so that it does NOT "fail on error" by default.

https://github.com/freefair/gradle-plugins/blob/b8b164c3ebb92442c693b3605fdb8db20af6a14b/maven-plugin/src/main/java/io/freefair/gradle/plugins/maven/javadoc/AggregateJavadocPlugin.java#L51

If we set failOnError = true for the javadoc task, the build then correctly fails when the javadoc tool fails to execute and generate documentation, which is the behavior we expect.

In light of that, we should set failOnError = true for all javadoc tasks to avoid such surprises in the future.

Related Issues

@sbrannen
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

1 participant