Skip to content

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

Open
@Marcono1234

Description

@Marcono1234

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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions