Skip to content

Generate real javadoc and sources Maven artifacts for embedded distributions (#24278)#26099

Open
renatsaf wants to merge 1 commit into
eclipse-ee4j:mainfrom
renatsaf:fix-empty-javadoc-artifacts-24278
Open

Generate real javadoc and sources Maven artifacts for embedded distributions (#24278)#26099
renatsaf wants to merge 1 commit into
eclipse-ee4j:mainfrom
renatsaf:fix-empty-javadoc-artifacts-24278

Conversation

@renatsaf

Copy link
Copy Markdown
Contributor

Problem

The glassfish-embedded-all and glassfish-embedded-web artifacts on Maven Central ship a javadoc JAR and a sources JAR that are empty:

  • the javadoc JAR was fabricated by a maven-jar-plugin create-empty-javadoc-jar hack pointing at a never-populated directory;
  • the sources JAR comes from the inherited source profile, but these modules have no src/main/java, so it only contains the POM.

As a result no Javadoc is published at javadoc.io (so the glassfish.org site cannot link to it), and IDEs cannot attach sources. See #24278.

Change

In the oss-release profile of both embedded modules:

  1. Collect sources of all bundled modules into a single source tree via maven-dependency-plugin:unpack-dependencies (sources classifier, failOnMissingClassifierArtifact=false since not every third-party dependency publishes sources, module-info.java excluded so javac does not switch into module mode).
  2. Build a real javadoc JAR from that tree with maven-javadoc-plugin (sourcepath = collected sources, best-effort: doclint=none, failOnError/Warnings=false, offline-link detection off).
  3. Build a real sources JAR from the same tree, and disable the inherited empty attach-sources execution so only one sources artifact is attached.

The dependency classes are already on the module's compile/runtime classpath, so javadoc resolves the bundled APIs.

Verification

  • help:effective-pom -P oss-release,source confirms the new executions are wired, the inherited attach-sources is overridden to phase none, and exactly one sources-classifier artifact is attached (no duplicate-classifier conflict).
  • A standalone proof-of-concept feeding aggregated sources JARs through maven-javadoc-plugin produced a complete, cross-linked Javadoc (unified index.html), confirming the approach generates non-empty output when the dependency classes are on the classpath.

Full content is produced by the release reactor build (where each component's sources JAR is built with the oss-release/source profiles).

Notes

The Full and Web distributions (distributions/glassfish, distributions/web, nucleus/distributions) still ship empty/missing javadoc & sources artifacts; they additionally skip javadoc and are zip-assembly modules, so they are left for a follow-up.

🤖 Generated with Claude Code

The glassfish-embedded-all and glassfish-embedded-web modules published an
empty javadoc JAR (fabricated by a maven-jar-plugin "create-empty-javadoc-jar"
hack) and an empty sources JAR (from the inherited 'source' profile, since
these modules have no src/main/java). As a result javadoc.io shows nothing and
IDEs cannot attach sources.

In the oss-release profile, collect the sources JARs of all bundled modules
into a single source tree (maven-dependency-plugin unpack-dependencies with the
sources classifier, excluding module-info.java) and build real javadoc and
sources JARs from it. The empty attach-sources execution is disabled in favour
of the aggregated sources JAR.

Issue eclipse-ee4j#24278

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant