spring-projects / spring-projects/spring-security

Antora documentation build fails on Windows; arguments not properly passed to `gradlew`

Open
#15,326 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: build type: bug
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Describe the bug
Building the documentation using Antora with ./gradlew :spring-security-docs:antora fails on Windows:

./gradlew :spring-security-docs:antora

> Task :spring-security-docs:antora FAILED
[02:11:39.247] FATAL (antora): (@antora/collector-extension): Command failed with exit code 1: C:\WINDOWS\system32\cmd.exe /d /s /c "gradlew.bat -q -PbuildSrc.skipTests=true -Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError :spring-security-docs:generateAntoraYml" in <redacted>\spring-security (branch: main <worktree> | start path: docs)

Unknown command-line option '-X'.

USAGE: gradlew [option...] [task...]

-?, -h, --help                     Shows this help message.
-a, --no-rebuild                   Do not rebuild project dependencies.
[... Gradle help output ...]


    Cause: Error
        at ChildProcess.<anonymous> (<redacted>\spring-security\docs\node_modules\@antora\collector-extension\lib\util\run-command.js:112:16)
        at ChildProcess.emit (node:events:519:28)
        at maybeClose (node:internal/child_process:1105:16)
        at ChildProcess._handle.onexit (node:internal/child_process:305:5)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':spring-security-docs:antora'.
> Process 'command '<redacted>\spring-security\docs\.gradle\nodejs\node-v20.15.0-win-x64\npx.cmd'' finished with non-zero exit value 1

Setup:

  • Windows 10
  • PowerShell 7.4.2

To Reproduce
On Windows:

  1. Clone the main branch of this repository
  2. Run
    ./gradlew :spring-security-docs:antora
    

Expected behavior
The build should succeed

Potential cause and workaround
This error seems to be related to the command value in the docs/antora.yml file.
Based on the error message printed to console, it seems " around the JVM args got lost, and therefore Gradle considered -XX:+HeapDumpOnOutOfMemoryError to be an argument to Gradle itself and not the JVM.

Workaround:
Edit the docs/antora.yml file and remove "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/antora.yml and inspect the command value used by the Antora build, especially the JVM arguments shown in the Windows failure. Reproduce the issue with ./gradlew :spring-security-docs:antora on Windows and verify that the command passes the arguments correctly and the documentation build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.