Skip to content

Fail Gradle build whenever a javadoc task fails #34837

Closed
@sbrannen

Description

@sbrannen

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions