Skip to content

Fix publish-javadoc workflow to generate docs in deploy path#64

Merged
BenCodez merged 2 commits into
mainfrom
copilot/fix-javadoc-deploy-issue
Jun 7, 2026
Merged

Fix publish-javadoc workflow to generate docs in deploy path#64
BenCodez merged 2 commits into
mainfrom
copilot/fix-javadoc-deploy-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 7, 2026

The Javadoc publish workflow was failing at deploy time because it expected SimpleAPI/target/apidocs, but the configured Maven invocation used a goal that did not produce docs in that path for this project setup.

  • Workflow command correction

    • Updated .github/workflows/publish-javadoc.yml to run the module Javadoc goal instead of the aggregate goal.
    • Kept javadoc-source-folder: 'SimpleAPI/target/apidocs' unchanged so deploy behavior remains consistent.
  • Resulting behavior

    • Javadocs are generated using the project’s configured maven-javadoc-plugin output directory (SimpleAPI/target/apidocs), aligning generation and deployment paths.
# .github/workflows/publish-javadoc.yml
custom-command: mvn -f SimpleAPI/pom.xml -P javadoc javadoc:javadoc
javadoc-source-folder: 'SimpleAPI/target/apidocs'
Original prompt

Fix the failing GitHub Actions job in repository BenCodez/SimpleAPI for the workflow .github/workflows/publish-javadoc.yml.

Observed failure:

  • Workflow run: 27103912570
  • Job id: 79989490583
  • Workflow file: .github/workflows/publish-javadoc.yml
  • The deploy action fails because the configured folder SimpleAPI/target/apidocs does not exist at deploy time.

Relevant findings:

  • The workflow currently uses MathieuSoysal/Javadoc-publisher.yml@main.
  • It runs the custom command:
    mvn -f SimpleAPI/pom.xml deploy -P javadoc javadoc:aggregate
  • It then deploys from:
    javadoc-source-folder: 'SimpleAPI/target/apidocs'
  • In SimpleAPI/pom.xml, the javadoc Maven profile configures maven-javadoc-plugin outputDirectory as ${project.basedir}/target/apidocs.
  • However, the command uses javadoc:aggregate, which does not produce the expected output folder for this setup, causing the deployment step to fail.

Requested change:

  • Update .github/workflows/publish-javadoc.yml so the workflow generates Javadocs into the expected SimpleAPI/target/apidocs folder before deployment.
  • Prefer replacing javadoc:aggregate with the correct Maven goal for this project layout.
  • Keep the fix minimal and focused on resolving the CI failure.

Acceptance criteria:

  • The workflow generates docs in SimpleAPI/target/apidocs.
  • The GitHub Pages deploy step no longer fails with a missing directory error.
  • Only make changes necessary to fix this failure.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The failure is in the deploy step, not the Javadoc generation itself.

Root cause

The workflow expects generated docs at:

But the Maven config only generates Javadocs during the deploy phase inside the javadoc profile:

The workflow runs:

custom-command: mvn -f SimpleAPI/pom.xml deploy -P javadoc javadoc:aggregate

javadoc:aggregate does not write to the configured target/apidocs path used by the deploy action, so the deploy step fails with:

The directory you're trying to deploy named .../SimpleAPI/target/apidocs doesn't exist.

Best fix

Generate the standard project Javadoc into the exact folder the workflow deploys, instead of using javadoc:aggregate.

Update .github/workflows/publish-javadoc.yml:

- name: Deploy JavaDoc 🚀
  uses: MathieuSoysal/Javadoc-publisher.yml@main
  with:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    javadoc-branch: gh-pages
    java-version: 21
    target-folder: ''
    project: maven
    custom-command: mvn -f SimpleAPI/pom.xml -P javadoc javadoc:javadoc
    javadoc-source-folder: 'SimpleAPI/target/apidocs'

Why this works

  • javadoc:javadoc matches the configured output directory in SimpleAPI/pom.xml.
  • The deploy action then finds SimpleAPI/target/apidocs as expected.
  • This avoids relying on aggregate behavior, which is mainly intended for multi-module/root aggregation and is the mismatch here.

Optional cleanup

In SimpleAPI/pom.xml, binding the javadoc execution to deploy is unnecessary for this workflow if the workflow explicitly calls the Javadoc goal. You can make it clearer by changing:

<phase>deploy</phase>

to:

<phase>package</phase>

or removing the phase binding entirely if you only invoke it directly from CI.

Extra note from the logs

There are repository warnings for dependency metadata and checksums, but they are not the job-ending error here. The fatal error is the missing directory:

  • expected deployed folder: SimpleAPI/target/apidocs
  • actual result: not created before the GitHub Pages deploy step

So the focused solution is: replace javadoc:aggregate with javadoc:javadoc so the configured SimpleAPI/target/apidocs folder is produced.

User: generate the pull request

Assistant: I’ve prepared the pull request creation and we’re currently waiting for your confirmation in the GitHub prompt before I can continue.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job for publishing Javadoc Fix publish-javadoc workflow to generate docs in deploy path Jun 7, 2026
Copilot AI requested a review from BenCodez June 7, 2026 20:37
@BenCodez BenCodez marked this pull request as ready for review June 7, 2026 20:39
@BenCodez BenCodez merged commit 9413f1a into main Jun 7, 2026
4 checks passed
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.

2 participants