{"id":19041874,"url":"https://github.com/allure-framework/allure-gradle","last_synced_at":"2025-04-10T01:34:02.995Z","repository":{"id":40614253,"uuid":"85480000","full_name":"allure-framework/allure-gradle","owner":"allure-framework","description":"Allure Gradle Plugin","archived":false,"fork":false,"pushed_at":"2024-07-30T16:16:32.000Z","size":360,"stargazers_count":86,"open_issues_count":18,"forks_count":36,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-29T16:56:29.485Z","etag":null,"topics":["allure","gradle","gradle-plugin","reporting"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allure-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-19T13:57:14.000Z","updated_at":"2024-10-24T13:27:21.000Z","dependencies_parsed_at":"2024-11-06T08:26:14.390Z","dependency_job_id":"0b3fb1af-f0d8-41ee-8393-8806861cfd6e","html_url":"https://github.com/allure-framework/allure-gradle","commit_stats":{"total_commits":91,"total_committers":15,"mean_commits":6.066666666666666,"dds":0.6703296703296704,"last_synced_commit":"2ae979691ff00198ddb831178eb9778e06776508"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allure-framework%2Fallure-gradle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allure-framework%2Fallure-gradle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allure-framework%2Fallure-gradle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allure-framework%2Fallure-gradle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allure-framework","download_url":"https://codeload.github.com/allure-framework/allure-gradle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595908,"owners_count":20964022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allure","gradle","gradle-plugin","reporting"],"created_at":"2024-11-08T22:33:00.195Z","updated_at":"2025-04-10T01:34:02.978Z","avatar_url":"https://github.com/allure-framework.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[release]: https://github.com/allure-framework/allure-gradle/releases/latest \"Release\"\n[release-badge]: https://img.shields.io/github/release/allure-framework/allure-gradle.svg\n\n# Allure plugin for Gradle [![Build](https://github.com/allure-framework/allure-gradle/actions/workflows/build.yml/badge.svg)](https://github.com/allure-framework/allure-gradle/actions/workflows/build.yml) [![release-badge][]][release]\n\nGradle projects plugins for building [Allure](https://docs.qameta.io/allure/latest/) reports for TestNG, JUnit4, JUnit5, Cucumber JVM, and Spock tests.\n\n## Basic usage\n\n`allure-gradle` plugin implements Allure data collecting (e.g. Test` tasks), and data reporting (both individual and aggregate reports).\n\nData colecting and reporting are split to different Gradle plugins, so you could apply the ones you need.\n\nNote:\n* allure-gradle 2.9+ requires Gradle 5.0+\n* allure-gradle 2.11+ requires Gradle 6.0+\n\nThe minimal configuration is as follows.\nIt would configure test tasks to collect Allure results and add `allureReport` and `allureServe`\ntasks for report inspection.\n\nGroovy DSL:\n\n```groovy\nplugins {\n    id'io.qameta.allure' version '\u003clatest\u003e'\n}\n\nrepositories {\n    // Repository is needed for downloading allure-commandline for building the report\n    mavenCentral()\n}\n```\n\nKotlin DSL:\n\n```kotlin\nplugins {\n    id(\"io.qameta.allure\") version \"\u003clatest\u003e\"\n}\n\nrepositories {\n    // Repository is needed for downloading allure-commandline for building the report\n    mavenCentral()\n}\n```\n\n`io.qameta.allure` is a shortcut for `io.qameta.allure-adapter` + `io.qameta.allure-report`,\nso you could apply the plugins you need.\n\n### Configuring Allure version\n\nGroovy DSL:\n\n```groovy\nallure {\n    value = \"2.30.0\"\n}\n```\n\nKotlin DSL:\n\n```kotlin\nallure {\n    value.set(\"2.30.0\")\n}\n```\n\n### Building Allure report\n\nTo build a report, and browse it use the following command:\n\n    ./gradlew allureServe\n\nNote: by default, `allureServe` does not execute tests, so if you want to execute the relevant\ntests and build report, use the following:\n\n    ./gradlew allureReport --depends-on-tests\n\nTo build an aggregate report, and browse it, apply `io.qameta.allure-aggregate-report` plugin and\nuse the following command:\n\n    ./gradlew allureAggregateServe\n\nIf you need a report only, please use `allureReport` and `allureAggregateReport`.\n\nBy default, `allureAggregate*` aggregates data from the current `project` and its `subprojects`.\nHowever, you need to apply `io.qameta.allure-adapter` plugin to the relevant subprojects, so they\nprovide Allure results.\n\n## Customizing data collecting\n\nData collecting is implemented via `io.qameta.allure-adapter` Gradle plugin.\n\nThe values in the sample below are the defaults.\nThe sample uses Kotlin DSL. In Groovy DSL you could use `allureJavaVersion = \"2.19.0\"`, however, that is the only difference.\n\n```kotlin\nallure {\n    version.set(\"2.30.0\")\n    adapter {\n        // Configure version for io.qameta.allure:allure-* adapters\n        // It defaults to allure.version\n        allureJavaVersion.set(\"2.28.0\")\n        aspectjVersion.set(\"1.9.22.1\")\n\n        // Customize environment variables for launching Allure\n        environment.put(\"JAVA_HOME\", \"/path/to/java_home\")\n\n        autoconfigure.set(true)\n        autoconfigureListeners.set(true)\n        aspectjWeaver.set(true)\n\n        // By default, categories.json is detected in src/test/resources/../categories.json,\n        // However, it would be better to put the file in a well-known location and configure it explicitly\n        categoriesFile.set(layout.projectDirectory.file(\"config/allure/categories.json\"))\n        frameworks {\n            junit5 {\n                // Defaults to allureJavaVersion\n                adapterVersion.set(\"...\")\n                enabled.set(true)\n                // Enables allure-junit4 default test listeners via META-INF/services/...\n                autoconfigureListeners.set(true)\n            }\n            junit4 {\n                // same as junit5\n            }\n            testng {\n                // same as junit5\n            }\n            spock\n            cucumberJvm\n            // Alternative syntax: cucumberJvm(2) {...}\n            cucumber2Jvm\n            cucumber3Jvm\n            cucumber4Jvm\n            cucumber5Jvm\n            cucumber6Jvm\n        }\n    }\n}\n```\n\n### What if I have both JUnit5, JUnit4, and CucumberJVM on the classpath?\n\nBy default, `allure-gradle` would detect all of them and apply all the listeners yielding 3 reports.\nIf you need only one or two, specify the required ones via `frameworks {...}` block.\n\n### Adding custom results for reporting\n\nYou could add a folder with custom results via `allureRawResultElements` Gradle configuration.\n\n```kotlin\nplugins {\n    id(\"io.qameta.allure-adapter-base\")\n}\n\ndependencies {\n    allureRawResultElements(files(layout.buildDirectory.dir(\"custom-allure-results\")))\n    // or\n    allureRawResultElements(files(\"$buildDir/custom-allure-results\"))\n}\n\n// If the results are built with a task, you might want adding a dependency so aggregate report\n// knows which tasks to run before building the report\nallureRawResultElements.outgoing.artifact(file(\"...\")) {\n    builtBy(customTask)\n}\n```\n\n### Using custom JUnit5 listeners instead of the default ones\n\n`allure-java` comes with a set of default listeners for JUnit4, JUnit5, and TestNG.\nHowever, you might want to disable them and use your own ones.\n\nHere's how you disable default listeners:\n\n```kotlin\nallure.adapter.frameworks.junit5.autoconfigureListeners.set(false)\n```\n\nAn alternative syntax is as follows:\n\n```kotlin\nallure {\n    adapter {\n        frameworks {\n            // Note: every time you mention an adapter, it is added to the classpath,\n            // so refrain from mentioning unused adapters here\n            junit5 {\n                // Disable allure-junit5 default test listeners\n                autoconfigureListeners.set(false)\n            }\n            testng {\n                // Disable allure-testng default test listeners\n                autoconfigureListeners.set(false)\n            }\n        }\n    }\n}\n```\n\n## Report generation\n\n### Aggregating results from multiple projects\n\nSuppose you have a couple of modules `/module1/build.gradle.kts`,\n`/module2/build.gradle.kts` that collect raw results for Allure:\n\n```kotlin\n// Each submodule\nplugin {\n    `java-library`\n    id(\"io.qameta.allure-adapter\")\n}\n\nallure {\n    adapter {\n        frameworks {\n            junit5\n        }\n    }\n}\n\n// Each Test task will write raw data for Allure automatically\n```\n\nHere's how you can aggregate that in their parent project (e.g. `root` project):\n\n`/build.gradle.kts`\n\n```kotlin\nplugin {\n    id(\"io.qameta.allure-aggregate-report\")\n}\n\n// allure-aggregate-report requires allure-commandline, so we need a repository here\nrepositories {\n    mavenCentral()\n}\n```\n\nBrowse report:\n\n    ./gradlew allureAggregateServe\n\nBy default `io.qameta.allure-aggregate-report` would aggregate results\nfrom `allprojects` (==current project + its subprojects), however,\nyou can configure the set of modules as follows:\n\n```kotlin\n// By default, aggregate-report aggregates allprojects (current + subprojects)\n// So we want to exclude module3 since it has no data for Allure\nconfigurations.allureAggregateReport.dependencies.remove(\n        project.dependencies.create(project(\":module3\"))\n)\n\n// Removing the default allprojects:\nconfigurations.allureAggregateReport.dependencies.clear()\n\n// Adding a custom dependency\ndependencies {\n    allureAggregateReport(project(\":module3\"))\n}\n```\n\n### Customizing report folders\n\nReport generation is implemented via `io.qameta.allure-report` Gradle plugin, so if you need reports,\napply the plugin as follows:\n\n```kotlin\nplugins {\n    id(\"io.qameta.allure-report\")\n}\n```\n\nBy default, the report is produced into Gradle's default reporting folder under `task.name` subfolder:\n\n   $buildDir/reports/allure-report/allureReport\n   $buildDir/reports/allure-report/allureAggregateReport\n\nYou could adjust the default location as follows:\n```kotlin\nplugins {\n    id(\"io.qameta.allure-report\") // the plugin is packaged with Gradle by default\n}\n\n// See https://docs.gradle.org/current/dsl/org.gradle.api.reporting.ReportingExtension.html\n// Extension is provided via Gradle's `reporting-base` plugin\nreporting {\n    baseDir = \"$buildDir/reports\"\n}\n\nallure {\n    report {\n        // There might be several tasks producing the report, so the property\n        // configures a base directory for all the reports\n        // Each task creates its own subfolder there\n        reportDir.set(project.reporting.baseDirectory.dir(\"allure-report\"))\n\n        // Enable single file generation to open without serving.\n        singleFile = true\n    }\n}\n```\n\n### Running tests before building the report\n\nBy default, `allureReport` task will NOT execute tests.\nThis enables trying new `categories.json` faster, however, if you need to see the latest results, the following\nmight help:\n\n* Execute tests separately: `./gradlew test`\n* Use `--depends-on-tests` as follows (the option should come after the task name): `./gradlew allureReport --depends-on-tests`\n* Configure `allure.report.dependsOnTest.set(true)`\n\n```kotlin\nallure {\n    report {\n        // By default, allureReport will NOT execute tests\n        // If the tests are fast (e.g. UP-TO-DATE or FROM-CACHE),\n        // then you might want configure dependsOnTests.set(true) so you always\n        // get the latest report from allureReport\n        dependsOnTests.set(false)\n    }\n}\n```\n\n### Customizing allure-commandline download\n\nAllure download is handled with `io.qameta.allure-download` plugin which adds `allureDownload` task.\nTypically, applying `io.qameta.allure-report` is enough, however, you could use `io.qameta.allure-download`\nif you do not need reporting and you need just a fresh `allure-commandline` binary.\n\nBy default `allure-commandline` is downloaded from Sonatype OSSRH (also known as Maven Central).\n\nThe plugin receives `allure-commandline` via `io.qameta.allure:allure-commandline:$version@zip` dependency.\n\nIf you have a customized version, you could configure it as follows:\n\n```kotlin\nallure {\n    // This configures the common Allure version, so it is used for commandline as well\n    version.set(\"2.30.0\")\n\n    commandline {\n        // The following patterns are supported: `[group]`, `[module]`, `[version]`, `[extension]`\n        // The patterns can appear severs times if you need\n        // By default, downloadUrlPattern is NOT set.\n        downloadUrlPattern.set(\"https://server/path/[group]/[module]-[version].[extension]\")\n\n        // groupId for allure-commandline\n        group.set(\"io.qameta.allure\")\n        // module for allure-commandline\n        module.set(\"allure-commandline\")\n        // extension for allure-commandline\n        extension.set(\"zip\")\n    }\n}\n```\n\nNote: if you configure `downloadUrlPattern`, then `io.qameta.allure-download` plugin configures\nan extra `ivy` repository with the provided URL, and it uses `custom.io.qameta.allure:allure-commandline:...`\ncoordinates to identify custom distribution is needed.\n\nIf you use Gradle 6.2+, then the custom repository is configured with `exclusive content filtering`\nwhich means the repository would be used exclusively for `custom.io.qameta.allure:allure-commandline`.\n\nIf you use Gradle 5.1+, then the repository would be configured with regular filtering, so it would be\nslightly less secure and slightly less efficient.\n\n### Using local allure-commandline binary\n\n`allure-commandline` is resolved via `allureCommandline` configuration, so you could configure\nlocal file as follows.\n\nRemember: NEVER use relative paths in your build files since \"current directory\" does not exist\nin a multi-threaded project execution (see https://youtrack.jetbrains.com/issue/IDEA-265203#focus=Comments-27-4795223.0-0).\n\n```kotlin\ndependencies {\n    // allureCommandline must resolve to a single zip file\n    // You could use regular Gradle syntax to specify the dependency\n    allureCommandline(files(\"/path/to/allure-commandline.zip\"))\n}\n```\n\n## Technical details\n\n### io.qameta.allure-base plugin\n\nExtensions:\n* io.qameta.allure.gradle.base.AllureExtension\n\n  `allure` extension for `project`\n\n### io.qameta.allure-adapter-base plugin\n\nExtensions:\n* io.qameta.allure.gradle.adapter.AllureAdapterExtension\n\n  `adapter` extension for `allure`\n\nConfigurations:\n* `allureRawResultElements`\n\n  A consumable configuration that exposes the collect raw data for building the report\n\nTasks:\n* `copyCategories: io.qameta.allure.gradle.adapter.tasks.CopyCategories`\n\n  Copies `categories.json` to the raw results folders.\n  See https://github.com/allure-framework/allure2/issues/1236\n\n### io.qameta.allure-adapter plugin\n\nConfigures automatic collectint of raw data from test tasks, adds `allure-java` adapters to the classpath.\n\nConfigurations:\n* `allureAspectjWeaverAgent`\n\n  A configuration to declare AspectJ agent jar for data collecting\n\n### io.qameta.allure-download plugin\n\nDownloads and unpacks `allure-commandline`\n\nExtensions:\n* `io.qameta.allure.gradle.download.AllureCommandlineExtension`\n\n  `commandline` extension for `allure`\n\nConfigurations:\n* `allureCommandline`\n\n  A configuration to resolve `allure-commandline` zip\n\nTasks:\n* `allureDownload: io.qameta.allure.gradle.download.tasks.DownloadAllure`\n\n  Retrieves and unpacks `allure-commandline`\n\n### io.qameta.allure-report-base plugin\n\nApplies `reporting-base` plugin and adds `allure.report` extension.\n\nExtensions:\n* `io.qameta.allure.gradle.report.AllureReportExtension`\n\n  `report` extension for `allure`\n\n### io.qameta.allure-report plugin\n\nBuilds Allure report for the current project.\n\nConfigurations:\n* `allureReport`\n\n  Note: prefer exposing raw results via `allureRawResultElements` configuration\n  rather than declaring them in `allureReport` configuration.\n\nTasks:\n* `allureReport: io.qameta.allure.gradle.report.tasks.AllureReport`\n\n  Builds Allure report for the current project\n\n* `allureServe: io.qameta.allure.gradle.report.tasks.AllureServe`\n\n  Launches a web server for browsing Allure report\n\n### io.qameta.allure-aggregate-report plugin\n\nBuilds Allure aggregate report.\n\nConfigurations:\n* `allureAggregateReport`\n\n  A configuration for declaring projects to aggregate the results from.\n  Each project exposes its raw results via `allureRawResultElements` configuration.\n\nTasks:\n* `allureAggregateReport: io.qameta.allure.gradle.report.tasks.AllureReport`\n\n  Builds Allure aggregate report\n\n* `allureAggregateServe: io.qameta.allure.gradle.report.tasks.AllureServe`\n\n  Launches a web server for browsing Allure aggregate report\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallure-framework%2Fallure-gradle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallure-framework%2Fallure-gradle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallure-framework%2Fallure-gradle/lists"}