Skip to content

[Bug]: AllureReport task passes multiple result directories as positional args, which Allure 3 CLI rejects #186

@jdicarlo-dh

Description

@jdicarlo-dh

Before submitting

  • I searched the existing issues and docs for a similar problem.
  • This issue is about allure-gradle, not another Allure integration.

Current behavior

The AllureReport task (used by both allureReport and allureAggregateReport) builds the CLI command by passing every result directory as a separate positional argument after generate:

allure generate /abs/path/results1 /abs/path/results2 /abs/path/results3 ... --config /path/to/allurerc.json

Allure 3's generate command only accepts a single positional argument (a glob pattern, defaulting to **/allure-results). When multiple positional arguments are provided, the CLI fails with:

Unknown Syntax Error: Command not found; did you mean one of:
  0. allure generate [--config,-c #0] [--output,-o #0] ...

This happens because AllureReport.kt's init block adds all result directories from rawResults as individual positional args via a ConditionalArgumentProvider, which was the correct behavior for Allure 2 but is incompatible with Allure 3.

Steps to reproduce

  1. Apply io.qameta.allure-adapter to multiple subprojects and io.qameta.allure-aggregate-report to the root project.
  2. Run tests across subprojects so multiple build/allure-results directories exist.
  3. Run ./gradlew allureAggregateReport.
  4. Observe the Unknown Syntax Error from the Allure 3 CLI.

Expected behavior

When using Allure 3, the plugin should invoke the CLI in a way that Allure 3 understands. For example, using --cwd pointed at the project root and letting Allure 3's default glob (**/allure-results) discover all result directories:

allure generate --cwd /path/to/project --config /path/to/allurerc.json

Reproducer

No response

Relevant Gradle configuration

// root build.gradle.kts
plugins {
    id("io.qameta.allure-aggregate-report")
}

allure {
    report {
        singleFile = true
    }
}

// subproject build.gradle.kts files apply plugin:
// id("io.qameta.allure-adapter")

allure-gradle version

4.0.1

Gradle version

9.4.1

Java version

21

Operating system

macOS

Gradle DSL

Kotlin DSL

Plugin ID(s) in use

io.qameta.allure-adapter, io.qameta.allure-aggregate-report

Test framework(s)

JUnit 5, Kotest

Allure runtime version

3.4.1

Log output or stack trace

// output of ./gradlew allureAggregateReport --info, truncated for clarity

> Task :allureAggregateReport
Input directories for allureAggregateReport: [<snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results]
Input directories for allureAggregateReport: [<snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results]
Custom actions are attached to task ':allureAggregateReport'.
Caching disabled for task ':allureAggregateReport' because:
  Build cache is disabled
  Not worth caching
Task ':allureAggregateReport' is not up-to-date because:
  Class path of task ':allureAggregateReport' has changed from 3dd03d5c6d143b33f6cd90cfe340a331 to f9ce7df4111ebe885009b7854e3635c2.
Input directories for allureAggregateReport: [<snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results, <snip>/build/allure-results]
Starting process 'command '<snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results --config <snip>/build/tmp/allureAggregateReport/allurerc.json
Successfully started process 'command '<snip>/build/allure/commandline/bin/allure''
Unknown Syntax Error: Command not found; did you mean one of:

  0. allure generate [--config,-c #0] [--output,-o #0] [--cwd #0] [--report-name,--name #0] [--dump #0] [--open] [--port #0] [--history-limit #0] [--hide-labels #0] [Pattern to match test results directories in the current working directory (default: ./**/allure-results)]
  1. allure generate [--config,-c #0] [--output,-o #0] [--cwd #0] [--report-name,--name #0] [--dump #0] [--open] [--port #0] [--history-limit #0] [--hide-labels #0] [Pattern to match test results directories in the current working directory (default: ./**/allure-results)]

While running generate <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results <snip>/build/allure-results --config <snip>/build/tmp/allureAggregateReport/allurerc.json

> Task :allureAggregateReport FAILED

Additional context

The issue is in AllureReport.kt's init block. The ConditionalArgumentProvider builds the args list like this:

args += GENERATE_COMMAND
val rawResults = rawResults.get().map { it.absolutePath }
args.addAll(rawResults)  // <-- adds all dirs as positional args
if (usesAllure3Runtime()) {
    args += "--config"
    args += allure3ConfigFile.get().asFile.absolutePath
}

For Allure 2, multiple positional directory args were valid. For Allure 3, the CLI expects a single glob pattern and
uses --cwd to set the search root.

Suggested fix: When usesAllure3Runtime() is true, pass --cwd <projectRoot> instead of individual directory
paths, and let Allure 3's default glob discover the result directories.

Workaround (which we're using in our build.gradle.kts):

import io.qameta.allure.gradle.report.tasks.AllureReport

tasks.named<AllureReport>("allureAggregateReport") {
    doFirst {
        val allArgs = argumentProviders.flatMap { it.asArguments() }
        val configIdx = allArgs.indexOf("--config")
        val configArgs = if (configIdx >= 0) listOf("--config", allArgs[configIdx + 1]) else emptyList()

        argumentProviders.clear()
        args = listOf("generate", "--cwd", rootDir.absolutePath) + configArgs
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions