[client/flink] generate javadoc for public modules#1724
[client/flink] generate javadoc for public modules#1724MehulBatra wants to merge 4 commits intoapache:mainfrom
Conversation
|
Thanks for the great work @MehulBatra ! Here are my thoughts about the javadoc design:
Here are suggestions about how to implement:
|
|
Thanks for the feedback @wuchong , I agree on all the points will implement on these lines! |
|
Github Action PR: apache/fluss-website#1 |
There was a problem hiding this comment.
Pull Request Overview
This PR implements javadoc generation for Apache Fluss's public API modules. The changes add a Maven-based javadoc build system that generates comprehensive API documentation for client and Flink integration modules while excluding internal implementation details.
- Added automated javadoc generation script with version-aware output structure
- Configured Docusaurus navigation to include Javadocs link
- Cleaned up minor formatting issues in root pom.xml
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| website/docusaurus.config.ts | Added Javadocs navigation link to website header |
| website/build_javadocs.sh | New script for generating javadocs with Maven, branch-aware versioning, and redirect page creation |
| pom.xml | Minor formatting cleanup removing extra blank lines |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| {to: '/community/welcome', label: 'Community', position: 'left'}, | ||
| {to: '/roadmap', label: 'Roadmap', position: 'left'}, | ||
| {to: '/downloads', label: 'Downloads', position: 'left'}, | ||
| {to: '/javadoc', label: 'Javadocs', position: 'left', target: '_blank'}, |
There was a problem hiding this comment.
Extra space before 'target: '_blank'' - there should be only one space after the comma for consistent formatting.
| {to: '/javadoc', label: 'Javadocs', position: 'left', target: '_blank'}, | |
| {to: '/javadoc', label: 'Javadocs', position: 'left', target: '_blank'}, |
| VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null || mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
| if [[ -z "$VERSION" ]]; then | ||
| echo "Error: Could not extract project version" |
There was a problem hiding this comment.
[nitpick] The command fallback logic could fail silently if both mvnw and mvn commands fail but return empty output. Consider adding explicit error handling to detect when both commands fail.
| VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null || mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| if [[ -z "$VERSION" ]]; then | |
| echo "Error: Could not extract project version" | |
| # Try to get version with ./mvnw first | |
| VERSION="" | |
| if [[ -x "./mvnw" ]]; then | |
| VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null) | |
| MVNW_STATUS=$? | |
| else | |
| MVNW_STATUS=127 | |
| fi | |
| if [[ $MVNW_STATUS -ne 0 || -z "$VERSION" ]]; then | |
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null) | |
| MVN_STATUS=$? | |
| else | |
| MVN_STATUS=0 | |
| fi | |
| if [[ ($MVNW_STATUS -ne 0 && $MVN_STATUS -ne 0) || -z "$VERSION" ]]; then | |
| echo "Error: Could not extract project version using either ./mvnw or mvn." |
| if (./mvnw -f "$TEMP_POM" clean compile javadoc:aggregate -q 2>/dev/null || mvn -f "$TEMP_POM" clean compile javadoc:aggregate -q); then | ||
| echo "Javadoc generation completed successfully" | ||
| else | ||
| echo "Error: Javadoc generation failed" |
There was a problem hiding this comment.
[nitpick] Similar to the version extraction, this Maven command fallback could benefit from more explicit error handling. The current approach may not distinguish between command not found vs actual build failures.
| if (./mvnw -f "$TEMP_POM" clean compile javadoc:aggregate -q 2>/dev/null || mvn -f "$TEMP_POM" clean compile javadoc:aggregate -q); then | |
| echo "Javadoc generation completed successfully" | |
| else | |
| echo "Error: Javadoc generation failed" | |
| # Explicit Maven command fallback with error handling | |
| if [[ -x "./mvnw" ]]; then | |
| echo "Using ./mvnw to build and generate Javadoc..." | |
| ./mvnw -f "$TEMP_POM" clean compile javadoc:aggregate -q | |
| MVN_EXIT_CODE=$? | |
| if [[ $MVN_EXIT_CODE -ne 0 ]]; then | |
| echo "Error: Javadoc generation failed using ./mvnw (exit code $MVN_EXIT_CODE)" | |
| exit 1 | |
| fi | |
| elif command -v mvn >/dev/null 2>&1; then | |
| echo "Using mvn to build and generate Javadoc..." | |
| mvn -f "$TEMP_POM" clean compile javadoc:aggregate -q | |
| MVN_EXIT_CODE=$? | |
| if [[ $MVN_EXIT_CODE -ne 0 ]]; then | |
| echo "Error: Javadoc generation failed using mvn (exit code $MVN_EXIT_CODE)" | |
| exit 1 | |
| fi | |
| else | |
| echo "Error: Neither ./mvnw nor mvn found. Please install Maven or ensure ./mvnw is present." |
| # Create temporary POM for targeted javadoc generation | ||
| TEMP_POM="temp-javadoc-pom.xml" | ||
| cat > "$TEMP_POM" << EOF | ||
| <?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
I remembered in the first version, you made the javadoc plugin changes in the root pom.xml. Why using a temp pom xml here? I think it's better to keep all the pom changes in the same place, so it's easier for future developers to modify both places.
| <version>3.6.3</version> | ||
| <configuration> | ||
| <windowTitle>Apache Fluss \${project.version} API</windowTitle> | ||
| <doctitle>Apache Fluss \${project.version} API</doctitle> |
There was a problem hiding this comment.
If we move the changes to root pom, we can use build-helper-maven-plugin to parse project version into without -SNAPSHOT suffix (e.g., the following base.version property).
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build><properties>
<base.version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</base.version>
</properties>|
|
||
| <modules> | ||
| <module>fluss-client</module> | ||
| <module>fluss-flink/fluss-flink-common</module> |
There was a problem hiding this comment.
I think we need to include fluss-common, fluss-rpc as well, most client side API are in fluss-common.
| cat > "$JAVADOC_INDEX" << EOF | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="refresh" content="0; url=${JAVADOC_VERSION}/"> | ||
| <title>Apache Fluss API Documentation</title> | ||
| </head> | ||
| <body> | ||
| <p>Redirecting to <a href="${JAVADOC_VERSION}/">Apache Fluss ${JAVADOC_VERSION} API</a></p> | ||
| </body> | ||
| </html> | ||
| EOF |
There was a problem hiding this comment.
Do we really need this index.html? As it is under javadoc/index.html, so multiple javadoc version will override this file.
|
Thank you @MehulBatra for the updates. The new architecture looks very good. I think there is only some minor improvements to do. Besides, I think we don't need a navbar for Javadoc, because Javadoc is also versioned, so it should be going into |


Purpose
Linked issue: close #1712
Implement javadoc generation
Brief change log
Tests
Manual testing of javadoc generation script with different scenarios
Verified generated HTML output structure and content
Validated redirect functionality and version-specific URL routing
Run:
API and Format
No API changes - This is purely a build/documentation improvement that doesn't affect runtime APIs.
Documentation
The generated javadoc itself serves as API reference documentation.