├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml ├── release.yml └── workflows │ ├── build.yml │ ├── label-verify.yml │ ├── publish.yml │ └── release.yml ├── .gitignore ├── .idea ├── icon.png └── vcs.xml ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── maven └── quality-configs │ ├── checkstyle │ ├── checkstyle-suppressions.xml │ └── checkstyle.xml │ ├── format.xml │ ├── pmd │ └── pmd.xml │ └── spotless │ └── header.java ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── it ├── aggregate-multi-module-exclude-report │ ├── first │ │ ├── pom.xml │ │ └── target │ │ │ └── allure-results │ │ │ └── first-testsuite.xml │ ├── pom.xml │ ├── second │ │ ├── pom.xml │ │ └── target │ │ │ └── allure-results │ │ │ └── second-testsuite.xml │ └── verify.groovy ├── aggregate-multi-module │ ├── first │ │ ├── pom.xml │ │ └── target │ │ │ └── allure-results │ │ │ └── first-testsuite.xml │ ├── pom.xml │ ├── second │ │ ├── pom.xml │ │ └── target │ │ │ └── allure-results │ │ │ └── second-testsuite.xml │ └── verify.groovy ├── aggregate-sample │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── allure-2-results │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.json │ └── verify.groovy ├── categories-file-support-test-classpath │ ├── pom.xml │ ├── target │ │ ├── allure-results │ │ │ └── sample-testsuite.xml │ │ └── test-classes │ │ │ └── categories.json │ └── verify.groovy ├── custom-url-report │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── feature-plugins-support │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── feature-should-fail-if-empty-report │ ├── invoker.properties │ ├── pom.xml │ └── target │ │ └── allure-results │ │ └── .gitkeep ├── feature-without-version-property │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── input-directory-sample │ ├── first │ │ └── first-testsuite.xml │ ├── pom.xml │ ├── second │ │ └── second-testsuite.xml │ └── verify.groovy ├── properties-file-support-compile-classpath │ ├── pom.xml │ ├── target │ │ ├── allure-results │ │ │ └── sample-testsuite.xml │ │ └── classes │ │ │ └── allure.properties │ └── verify.groovy ├── properties-file-support-configuration │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── properties-file-support-default-location │ ├── pom.xml │ ├── report.properties │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── properties-file-support-placeholder │ ├── allure.properties │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── properties-file-support-test-classpath │ ├── pom.xml │ ├── target │ │ ├── allure-results │ │ │ └── sample-testsuite.xml │ │ └── test-classes │ │ │ └── report.properties │ └── verify.groovy ├── properties-file-support │ ├── allure.properties │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── report-as-build-plugin │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── report-change-report-directory │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── report-change-results-directory │ ├── pom.xml │ ├── target │ │ └── my-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── report-multi-module │ ├── first │ │ ├── pom.xml │ │ └── target │ │ │ └── allure-results │ │ │ └── first-testsuite.xml │ ├── pom.xml │ ├── second │ │ ├── pom.xml │ │ └── target │ │ │ └── allure-results │ │ │ └── second-testsuite.xml │ └── verify.groovy ├── report-single-file │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy ├── report-with-bundled-version │ ├── pom.xml │ ├── target │ │ └── allure-results │ │ │ └── sample-testsuite.xml │ └── verify.groovy └── settings.xml ├── main └── java │ └── io │ └── qameta │ └── allure │ └── maven │ ├── AllureAggregateMojo.java │ ├── AllureBaseMojo.java │ ├── AllureCommandline.java │ ├── AllureGenerateMojo.java │ ├── AllureInstallMojo.java │ ├── AllureReportMojo.java │ ├── AllureServeMojo.java │ ├── ProxyUtils.java │ └── VersionUtils.java └── test └── java └── io └── qameta └── allure └── maven └── TestHelper.java /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | We love pull requests from everyone. 4 | 5 | Fork, then clone the repo: 6 | 7 | ```bash 8 | $ git clone git@github.com:your-username/allure-maven.git 9 | ``` 10 | 11 | Then build the project (build requires JDK 1.8 or higher): 12 | 13 | ```bash 14 | $ ./mvnw install 15 | ``` 16 | 17 | Make your change. Add tests for your change. Make sure all the tests pass: 18 | 19 | ```bash 20 | $ ./mvnw verify 21 | ``` 22 | 23 | Push your fork and submit a pull request. 24 | 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 15 | 16 | #### I'm submitting a ... 17 | 18 | - [ ] bug report 19 | - [ ] feature request 20 | - [ ] support request => Please do not submit support request here, see note at the top of this template. 21 | 22 | #### What is the current behavior? 23 | 24 | #### If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem 25 | 26 | #### What is the expected behavior? 27 | 28 | #### What is the motivation / use case for changing the behavior? 29 | 30 | #### Please tell us about your environment: 31 | 32 | - Allure version: 2.1.0 33 | - Test framework: testng@6.8 34 | - Allure adaptor: allure-testng@2.0-BETA8 35 | - Generate report using: allure-maven@2.18 36 | 37 | #### Other information 38 | 39 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | ### Context 15 | 18 | 19 | #### Checklist 20 | - [ ] [Sign Allure CLA][cla] 21 | - [ ] Provide unit tests 22 | 23 | [cla]: https://cla-assistant.io/accept/allure-framework/allure2 24 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | labels: 8 | - "type:dependencies" 9 | 10 | - package-ecosystem: "maven" 11 | directory: "/" 12 | schedule: 13 | interval: "daily" 14 | labels: 15 | - "type:dependencies" 16 | 17 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | # release.yml 2 | 3 | changelog: 4 | categories: 5 | - title: '🚀 New Features' 6 | labels: 7 | - 'type:new feature' 8 | - title: '🔬 Improvements' 9 | labels: 10 | - 'type:improvement' 11 | - title: '🐞 Bug Fixes' 12 | labels: 13 | - 'type:bug' 14 | - title: '⬆️ Dependency Updates' 15 | labels: 16 | - 'type:dependencies' 17 | - title: '⛔️ Security' 18 | labels: 19 | - 'type:security' 20 | - title: '👻 Internal changes' 21 | labels: 22 | - 'type:internal' 23 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - '*' 7 | push: 8 | branches: 9 | - 'main' 10 | - 'hotfix-*' 11 | 12 | jobs: 13 | build: 14 | name: "Build" 15 | runs-on: ubuntu-latest 16 | strategy: 17 | matrix: 18 | java-version: [ '8.0.x', '11.0.x', '17.0.x' ] 19 | steps: 20 | - uses: actions/checkout@v4.2.2 21 | - name: Set up JDK ${{ matrix.java-version }} 22 | uses: actions/setup-java@v4 23 | with: 24 | distribution: 'zulu' 25 | java-version: ${{ matrix.java-version }} 26 | - name: Maven Build 27 | run: ./mvnw -Dmaven.test.failure.ignore=true clean verify --no-transfer-progress 28 | -------------------------------------------------------------------------------- /.github/workflows/label-verify.yml: -------------------------------------------------------------------------------- 1 | name: "Verify type labels" 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, labeled, unlabeled, synchronize] 6 | 7 | jobs: 8 | triage: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: baev/action-label-verify@main 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | allowed: | 15 | type:bug 16 | type:improvement 17 | type:internal 18 | type:invalid 19 | type:new feature 20 | type:dependencies 21 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Release 2 | 3 | on: 4 | release: 5 | types: [ published ] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4.2.2 12 | 13 | - name: Set up JDK 1.8 14 | uses: actions/setup-java@v4 15 | with: 16 | distribution: 'zulu' 17 | java-version: 8.0.x 18 | 19 | - name: Set up Maven 20 | uses: s4u/maven-settings-action@v3.1.0 21 | with: 22 | servers: '[{"id": "ossrh", "username": "${{secrets.OSSRH_USERNAME}}", "password": "${{secrets.OSSRH_PASSWORD}}"}]' 23 | 24 | - name: Set up GPG 25 | run: | 26 | export GPG_TTY=$(tty) 27 | echo -n "${GPG_PRIVATE_KEY}" | base64 --decode | gpg --batch --import 28 | env: 29 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 30 | 31 | - name: "Maven Build" 32 | run: ./mvnw -Dinvoker.skip=true install 33 | 34 | - name: "Maven Publish" 35 | run: | 36 | ./mvnw -Dinvoker.skip=true -Pgpg deploy \ 37 | -Dgpg.keyname=${GPG_KEY_ID} \ 38 | -Dgpg.passphrase=${GPG_PASSPHRASE} \ 39 | env: 40 | GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} 41 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 42 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | run-name: Release ${{ inputs.releaseVersion }} (next ${{ inputs.nextVersion }}) by ${{ github.actor }} 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | releaseVersion: 8 | description: "The release version in .. format" 9 | required: true 10 | nextVersion: 11 | description: "The next version in . format WITHOUT SNAPSHOT SUFFIX" 12 | required: true 13 | 14 | jobs: 15 | triage: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: "Check release version" 19 | run: | 20 | expr "${{ github.event.inputs.releaseVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$' 21 | 22 | - name: "Check next version" 23 | run: | 24 | expr "${{ github.event.inputs.nextVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$' 25 | 26 | - uses: actions/checkout@v4.2.2 27 | with: 28 | token: ${{ secrets.QAMETA_CI }} 29 | 30 | - name: "Configure CI Git User" 31 | run: | 32 | git config --global user.name qameta-ci 33 | git config --global user.email qameta-ci@qameta.io 34 | 35 | - name: "Set release version" 36 | run: | 37 | ./mvnw versions:set -DnewVersion=${{ github.event.inputs.releaseVersion }} 38 | 39 | - name: "Commit release version and create tag" 40 | run: | 41 | git commit -am "release ${{ github.event.inputs.releaseVersion }}" 42 | git tag ${{ github.event.inputs.releaseVersion }} 43 | git push origin ${{ github.event.inputs.releaseVersion }} 44 | 45 | - name: "Set next development version" 46 | run: | 47 | ./mvnw versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}-SNAPSHOT 48 | 49 | - name: "Commit next development version and push it" 50 | run: | 51 | git commit -am "set next development version ${{ github.event.inputs.nextVersion }}" 52 | git push origin ${{ github.ref }} 53 | 54 | - name: "Publish Github Release" 55 | uses: octokit/request-action@v2.x 56 | with: 57 | route: POST /repos/${{ github.repository }}/releases 58 | tag_name: ${{ github.event.inputs.releaseVersion }} 59 | generate_release_notes: true 60 | target_commitish: ${{ github.ref }} 61 | env: 62 | GITHUB_TOKEN: ${{ secrets.QAMETA_CI }} 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #IDEA Files 2 | .idea/* 3 | !.idea/vcs.xml 4 | !.idea/icon.png 5 | *.iml 6 | *.ipr 7 | 8 | #Eclipse files 9 | *.settings 10 | *.classpath 11 | *.project 12 | *.pydevproject 13 | 14 | target 15 | !*/it/**/target 16 | -------------------------------------------------------------------------------- /.idea/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allure-framework/allure-maven/35fd212a6585a8d5e14e16e704f08cb7b1f8f607/.idea/icon.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at allure@qameta.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017-2024 Qameta Software Inc 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [release]: https://github.com/allure-framework/allure-maven/releases/latest "Release" 2 | [release-badge]: https://img.shields.io/github/release/allure-framework/allure-maven.svg 3 | 4 | # Allure Maven Plugin 5 | 6 | [![Build](https://github.com/allure-framework/allure-maven/actions/workflows/build.yml/badge.svg)](https://github.com/allure-framework/allure-maven/actions/workflows/build.yml) [![release-badge][]][release] 7 | 8 | > This plugin generates Allure Report from [allure-results](https://allurereport.org/docs/how-it-works/). 9 | 10 | [Allure Report logo](https://allurereport.org "Allure Report") 11 | 12 | - Learn more about Allure Report at https://allurereport.org 13 | - 📚 [Documentation](https://allurereport.org/docs/) – discover official documentation for Allure Report 14 | - ❓ [Questions and Support](https://github.com/orgs/allure-framework/discussions/categories/questions-support) – get help from the team and community 15 | - 📢 [Official annoucements](https://github.com/orgs/allure-framework/discussions/categories/announcements) – be in touch with the latest updates 16 | - 💬 [General Discussion ](https://github.com/orgs/allure-framework/discussions/categories/general-discussion) – engage in casual conversations, share insights and ideas with the community 17 | 18 | --- 19 | 20 | ## Getting Started 21 | 22 | * Add following lines into your `pom.xml` build section: 23 | ``` 24 | 25 | io.qameta.allure 26 | allure-maven 27 | 2.12.0 28 | 29 | ``` 30 | 31 | * `mvn clean test` - run your tests 32 | 33 | You can generate a report using one of the following command: 34 | 35 | * `mvn allure:serve` 36 | 37 | Report will be generated into temp folder. Web server with results will start. 38 | 39 | * `mvn allure:report` 40 | 41 | Report will be generated tо directory: `target/site/allure-maven/index.html` 42 | 43 | ## Configuration 44 | 45 | You can configure Allure Report version by using `reportVersion` property: 46 | ``` 47 | 48 | io.qameta.allure 49 | allure-maven 50 | 2.12.0 51 | 52 | 2.30.0 53 | 54 | 55 | ``` 56 | 57 | Additional information can be found [on official website](https://allurereport.org/). 58 | -------------------------------------------------------------------------------- /maven/quality-configs/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /maven/quality-configs/checkstyle/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /maven/quality-configs/pmd/pmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | General Java quality rules. 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /maven/quality-configs/spotless/header.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Apache Maven Wrapper startup batch script, version 3.3.2 23 | # 24 | # Optional ENV vars 25 | # ----------------- 26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source 27 | # MVNW_REPOURL - repo url base for downloading maven distribution 28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output 30 | # ---------------------------------------------------------------------------- 31 | 32 | set -euf 33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x 34 | 35 | # OS specific support. 36 | native_path() { printf %s\\n "$1"; } 37 | case "$(uname)" in 38 | CYGWIN* | MINGW*) 39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" 40 | native_path() { cygpath --path --windows "$1"; } 41 | ;; 42 | esac 43 | 44 | # set JAVACMD and JAVACCMD 45 | set_java_home() { 46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched 47 | if [ -n "${JAVA_HOME-}" ]; then 48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 49 | # IBM's JDK on AIX uses strange locations for the executables 50 | JAVACMD="$JAVA_HOME/jre/sh/java" 51 | JAVACCMD="$JAVA_HOME/jre/sh/javac" 52 | else 53 | JAVACMD="$JAVA_HOME/bin/java" 54 | JAVACCMD="$JAVA_HOME/bin/javac" 55 | 56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then 57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 59 | return 1 60 | fi 61 | fi 62 | else 63 | JAVACMD="$( 64 | 'set' +e 65 | 'unset' -f command 2>/dev/null 66 | 'command' -v java 67 | )" || : 68 | JAVACCMD="$( 69 | 'set' +e 70 | 'unset' -f command 2>/dev/null 71 | 'command' -v javac 72 | )" || : 73 | 74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then 75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 76 | return 1 77 | fi 78 | fi 79 | } 80 | 81 | # hash string like Java String::hashCode 82 | hash_string() { 83 | str="${1:-}" h=0 84 | while [ -n "$str" ]; do 85 | char="${str%"${str#?}"}" 86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) 87 | str="${str#?}" 88 | done 89 | printf %x\\n $h 90 | } 91 | 92 | verbose() { :; } 93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } 94 | 95 | die() { 96 | printf %s\\n "$1" >&2 97 | exit 1 98 | } 99 | 100 | trim() { 101 | # MWRAPPER-139: 102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. 103 | # Needed for removing poorly interpreted newline sequences when running in more 104 | # exotic environments such as mingw bash on Windows. 105 | printf "%s" "${1}" | tr -d '[:space:]' 106 | } 107 | 108 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties 109 | while IFS="=" read -r key value; do 110 | case "${key-}" in 111 | distributionUrl) distributionUrl=$(trim "${value-}") ;; 112 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; 113 | esac 114 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" 115 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" 116 | 117 | case "${distributionUrl##*/}" in 118 | maven-mvnd-*bin.*) 119 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ 120 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in 121 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; 122 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; 123 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; 124 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; 125 | *) 126 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 127 | distributionPlatform=linux-amd64 128 | ;; 129 | esac 130 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" 131 | ;; 132 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; 133 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; 134 | esac 135 | 136 | # apply MVNW_REPOURL and calculate MAVEN_HOME 137 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 138 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" 139 | distributionUrlName="${distributionUrl##*/}" 140 | distributionUrlNameMain="${distributionUrlName%.*}" 141 | distributionUrlNameMain="${distributionUrlNameMain%-bin}" 142 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" 143 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" 144 | 145 | exec_maven() { 146 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : 147 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" 148 | } 149 | 150 | if [ -d "$MAVEN_HOME" ]; then 151 | verbose "found existing MAVEN_HOME at $MAVEN_HOME" 152 | exec_maven "$@" 153 | fi 154 | 155 | case "${distributionUrl-}" in 156 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; 157 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; 158 | esac 159 | 160 | # prepare tmp dir 161 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then 162 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } 163 | trap clean HUP INT TERM EXIT 164 | else 165 | die "cannot create temp dir" 166 | fi 167 | 168 | mkdir -p -- "${MAVEN_HOME%/*}" 169 | 170 | # Download and Install Apache Maven 171 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 172 | verbose "Downloading from: $distributionUrl" 173 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 174 | 175 | # select .zip or .tar.gz 176 | if ! command -v unzip >/dev/null; then 177 | distributionUrl="${distributionUrl%.zip}.tar.gz" 178 | distributionUrlName="${distributionUrl##*/}" 179 | fi 180 | 181 | # verbose opt 182 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' 183 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v 184 | 185 | # normalize http auth 186 | case "${MVNW_PASSWORD:+has-password}" in 187 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; 188 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; 189 | esac 190 | 191 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then 192 | verbose "Found wget ... using wget" 193 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" 194 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then 195 | verbose "Found curl ... using curl" 196 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" 197 | elif set_java_home; then 198 | verbose "Falling back to use Java to download" 199 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" 200 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" 201 | cat >"$javaSource" <<-END 202 | public class Downloader extends java.net.Authenticator 203 | { 204 | protected java.net.PasswordAuthentication getPasswordAuthentication() 205 | { 206 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); 207 | } 208 | public static void main( String[] args ) throws Exception 209 | { 210 | setDefault( new Downloader() ); 211 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); 212 | } 213 | } 214 | END 215 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java 216 | verbose " - Compiling Downloader.java ..." 217 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" 218 | verbose " - Running Downloader.java ..." 219 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" 220 | fi 221 | 222 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 223 | if [ -n "${distributionSha256Sum-}" ]; then 224 | distributionSha256Result=false 225 | if [ "$MVN_CMD" = mvnd.sh ]; then 226 | echo "Checksum validation is not supported for maven-mvnd." >&2 227 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 228 | exit 1 229 | elif command -v sha256sum >/dev/null; then 230 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then 231 | distributionSha256Result=true 232 | fi 233 | elif command -v shasum >/dev/null; then 234 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then 235 | distributionSha256Result=true 236 | fi 237 | else 238 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 239 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 240 | exit 1 241 | fi 242 | if [ $distributionSha256Result = false ]; then 243 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 244 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 245 | exit 1 246 | fi 247 | fi 248 | 249 | # unzip and move 250 | if command -v unzip >/dev/null; then 251 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" 252 | else 253 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" 254 | fi 255 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" 256 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" 257 | 258 | clean || : 259 | exec_maven "$@" 260 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | <# : batch portion 2 | @REM ---------------------------------------------------------------------------- 3 | @REM Licensed to the Apache Software Foundation (ASF) under one 4 | @REM or more contributor license agreements. See the NOTICE file 5 | @REM distributed with this work for additional information 6 | @REM regarding copyright ownership. The ASF licenses this file 7 | @REM to you under the Apache License, Version 2.0 (the 8 | @REM "License"); you may not use this file except in compliance 9 | @REM with the License. You may obtain a copy of the License at 10 | @REM 11 | @REM http://www.apache.org/licenses/LICENSE-2.0 12 | @REM 13 | @REM Unless required by applicable law or agreed to in writing, 14 | @REM software distributed under the License is distributed on an 15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | @REM KIND, either express or implied. See the License for the 17 | @REM specific language governing permissions and limitations 18 | @REM under the License. 19 | @REM ---------------------------------------------------------------------------- 20 | 21 | @REM ---------------------------------------------------------------------------- 22 | @REM Apache Maven Wrapper startup batch script, version 3.3.2 23 | @REM 24 | @REM Optional ENV vars 25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution 26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output 28 | @REM ---------------------------------------------------------------------------- 29 | 30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) 31 | @SET __MVNW_CMD__= 32 | @SET __MVNW_ERROR__= 33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% 34 | @SET PSModulePath= 35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( 36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) 37 | ) 38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% 39 | @SET __MVNW_PSMODULEP_SAVE= 40 | @SET __MVNW_ARG0_NAME__= 41 | @SET MVNW_USERNAME= 42 | @SET MVNW_PASSWORD= 43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) 44 | @echo Cannot start maven from wrapper >&2 && exit /b 1 45 | @GOTO :EOF 46 | : end batch / begin powershell #> 47 | 48 | $ErrorActionPreference = "Stop" 49 | if ($env:MVNW_VERBOSE -eq "true") { 50 | $VerbosePreference = "Continue" 51 | } 52 | 53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties 54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl 55 | if (!$distributionUrl) { 56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" 57 | } 58 | 59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { 60 | "maven-mvnd-*" { 61 | $USE_MVND = $true 62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" 63 | $MVN_CMD = "mvnd.cmd" 64 | break 65 | } 66 | default { 67 | $USE_MVND = $false 68 | $MVN_CMD = $script -replace '^mvnw','mvn' 69 | break 70 | } 71 | } 72 | 73 | # apply MVNW_REPOURL and calculate MAVEN_HOME 74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 75 | if ($env:MVNW_REPOURL) { 76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } 77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" 78 | } 79 | $distributionUrlName = $distributionUrl -replace '^.*/','' 80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' 81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" 82 | if ($env:MAVEN_USER_HOME) { 83 | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" 84 | } 85 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' 86 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" 87 | 88 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { 89 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" 90 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 91 | exit $? 92 | } 93 | 94 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { 95 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" 96 | } 97 | 98 | # prepare tmp dir 99 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile 100 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" 101 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null 102 | trap { 103 | if ($TMP_DOWNLOAD_DIR.Exists) { 104 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 105 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 106 | } 107 | } 108 | 109 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null 110 | 111 | # Download and Install Apache Maven 112 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 113 | Write-Verbose "Downloading from: $distributionUrl" 114 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 115 | 116 | $webclient = New-Object System.Net.WebClient 117 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { 118 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) 119 | } 120 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 121 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null 122 | 123 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 124 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum 125 | if ($distributionSha256Sum) { 126 | if ($USE_MVND) { 127 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." 128 | } 129 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash 130 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { 131 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." 132 | } 133 | } 134 | 135 | # unzip and move 136 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null 137 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null 138 | try { 139 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null 140 | } catch { 141 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { 142 | Write-Error "fail to move MAVEN_HOME" 143 | } 144 | } finally { 145 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 146 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 147 | } 148 | 149 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 150 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | io.qameta.allure 6 | allure-maven 7 | 2.16-SNAPSHOT 8 | 9 | maven-plugin 10 | 11 | Allure Maven 12 | Maven integration with Allure reporting 13 | https://github.com/allure-framework/allure-maven 14 | 15 | 16 | UTF-8 17 | 1.8 18 | 19 | 3.9.9 20 | 3.15.1 21 | 22 | 7.9.0 23 | 24 | 25 | 26 | Qameta.io 27 | https://qameta.io 28 | 29 | 30 | 31 | 32 | The Apache Software License, Version 2.0 33 | http://www.apache.org/licenses/LICENSE-2.0.txt 34 | repo 35 | 36 | 37 | 38 | 39 | https://github.com/allure-framework/allure-maven 40 | scm:git@github.com:allure-framework/allure-maven.git 41 | scm:git:git@github.com:allure-framework/allure-maven.git 42 | HEAD 43 | 44 | 45 | 46 | Jenkins 47 | https://ci.qameta.io/job/allure-maven 48 | 49 | 50 | 51 | GitHub Issues 52 | https://github.com/allure-framework/allure-maven/issues 53 | 54 | 55 | 56 | 57 | eroshenkoam 58 | Artem Eroshenko 59 | eroshenkoam@qameta.io 60 | 61 | 62 | baev 63 | Dmitry Baev 64 | dmitry.baev@qameta.io 65 | 66 | 67 | 68 | 69 | 70 | Allure Mailing List 71 | allure@qameta.io 72 | 73 | 74 | 75 | 76 | 3.1.1 77 | 78 | 79 | 80 | 81 | 82 | 83 | org.apache.maven.plugins 84 | maven-plugin-plugin 85 | ${maven-plugin.version} 86 | 87 | allure 88 | true 89 | 90 | 91 | 92 | mojo-descriptor 93 | process-classes 94 | 95 | descriptor 96 | 97 | 98 | 99 | generated-helpmojo 100 | 101 | helpmojo 102 | 103 | 104 | 105 | 106 | 107 | org.apache.maven.plugins 108 | maven-site-plugin 109 | 3.21.0 110 | 111 | 112 | org.apache.maven.plugins 113 | maven-project-info-reports-plugin 114 | 3.8.0 115 | 116 | 117 | 118 | 119 | 120 | 121 | org.apache.maven.plugins 122 | maven-compiler-plugin 123 | 3.13.0 124 | 125 | ${compiler.version} 126 | ${compiler.version} 127 | 128 | 129 | 130 | org.apache.maven.plugins 131 | maven-jar-plugin 132 | 3.4.2 133 | 134 | 135 | 136 | io.qameta.allure.maven 137 | 138 | 139 | 140 | 141 | 142 | org.apache.maven.plugins 143 | maven-source-plugin 144 | 3.3.1 145 | 146 | 147 | attach-sources 148 | 149 | jar 150 | 151 | 152 | 153 | 154 | 155 | org.apache.maven.plugins 156 | maven-javadoc-plugin 157 | 3.11.2 158 | 159 | 160 | attach-javadocs 161 | 162 | jar 163 | 164 | 165 | -Xdoclint:none 166 | 8 167 | false 168 | 169 | 170 | 171 | 172 | 173 | org.apache.maven.plugins 174 | maven-release-plugin 175 | 3.1.1 176 | 177 | @{project.version} 178 | 179 | 180 | 181 | com.diffplug.spotless 182 | spotless-maven-plugin 183 | 2.29.0 184 | 185 | 186 | 187 | ${project.basedir}/maven/quality-configs/format.xml 188 | 189 | 190 | 191 | 192 | 193 | ${project.basedir}/maven/quality-configs/spotless/header.java 194 | 195 | 196 | 197 | 198 | 199 | 200 | check 201 | 202 | 203 | 204 | 205 | 206 | org.apache.maven.plugins 207 | maven-checkstyle-plugin 208 | 3.6.0 209 | 210 | ${project.basedir}/maven/quality-configs/checkstyle/checkstyle.xml 211 | ${project.basedir}/maven/quality-configs/checkstyle/checkstyle-suppressions.xml 212 | UTF-8 213 | true 214 | true 215 | false 216 | 217 | 218 | 219 | com.puppycrawl.tools 220 | checkstyle 221 | 9.3 222 | 223 | 224 | 225 | 226 | validate 227 | validate 228 | 229 | check 230 | 231 | 232 | 233 | 234 | 235 | org.apache.maven.plugins 236 | maven-pmd-plugin 237 | 3.26.0 238 | 239 | 240 | ${project.basedir}/maven/quality-configs/pmd/pmd.xml 241 | 242 | false 243 | true 244 | 245 | target/generated-sources 246 | 247 | 248 | 249 | 250 | net.sourceforge.pmd 251 | pmd-core 252 | ${pmd.version} 253 | 254 | 255 | net.sourceforge.pmd 256 | pmd-java 257 | ${pmd.version} 258 | 259 | 260 | org.apache.maven 261 | maven-core 262 | ${maven.version} 263 | 264 | 265 | 266 | 267 | validate 268 | validate 269 | 270 | check 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | org.slf4j 281 | slf4j-api 282 | 2.0.16 283 | 284 | 285 | org.apache.httpcomponents.client5 286 | httpclient5 287 | 5.4.1 288 | 289 | 290 | com.fasterxml.jackson.core 291 | jackson-databind 292 | 2.18.2 293 | 294 | 295 | 296 | 297 | org.apache.maven 298 | maven-plugin-api 299 | ${maven.version} 300 | provided 301 | 302 | 303 | org.apache.maven 304 | maven-core 305 | ${maven.version} 306 | 307 | 308 | org.apache.maven.reporting 309 | maven-reporting-impl 310 | 4.0.0 311 | 312 | 313 | org.iq80.snappy 314 | snappy 315 | 316 | 317 | 318 | 319 | org.apache.maven.shared 320 | maven-artifact-transfer 321 | 0.13.1 322 | 323 | 324 | 325 | commons-beanutils 326 | commons-beanutils 327 | 1.10.0 328 | 329 | 330 | net.lingala.zip4j 331 | zip4j 332 | 2.11.5 333 | 334 | 335 | org.apache.commons 336 | commons-exec 337 | 1.4.0 338 | 339 | 340 | org.apache.commons 341 | commons-text 342 | 1.13.0 343 | 344 | 345 | org.apache.maven.plugin-tools 346 | maven-plugin-annotations 347 | ${maven-plugin.version} 348 | 349 | 350 | org.apache.maven.plugins 351 | maven-jxr-plugin 352 | 3.6.0 353 | 354 | 355 | junit 356 | junit 357 | 4.13.2 358 | test 359 | 360 | 361 | org.hamcrest 362 | hamcrest 363 | 3.0 364 | test 365 | 366 | 367 | ru.yandex.qatools.matchers 368 | nio-matchers 369 | 1.4.1 370 | test 371 | 372 | 373 | 374 | 375 | 376 | gpg 377 | 378 | false 379 | 380 | 381 | 382 | 383 | org.apache.maven.plugins 384 | maven-gpg-plugin 385 | 3.2.7 386 | 387 | 388 | sign-artifacts 389 | verify 390 | 391 | sign 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | it 401 | 402 | true 403 | 404 | 405 | 406 | 407 | org.apache.maven.plugins 408 | maven-invoker-plugin 409 | 3.8.1 410 | 411 | ${project.build.directory}/it 412 | ${project.build.directory}/local-repo 413 | 414 | site 415 | 416 | true 417 | setup 418 | verify 419 | true 420 | 421 | 422 | 423 | integration-test 424 | 425 | install 426 | run 427 | 428 | 429 | 430 | 431 | 432 | org.codehaus.groovy 433 | groovy-all 434 | 2.4.21 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | it-skip 443 | 444 | 445 | skipTests 446 | true 447 | 448 | 449 | 450 | 451 | 452 | maven-invoker-plugin 453 | 454 | true 455 | 456 | 457 | 458 | 459 | 460 | 461 | it-local-resolve 462 | 463 | true 464 | 465 | 466 | 467 | 468 | maven-invoker-plugin 469 | 470 | src/it/settings.xml 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | ossrh 481 | Central Repository OSSRH 482 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 483 | 484 | 485 | 486 | 487 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module-exclude-report/first/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | allure-maven-it-first-child 7 | 1.0-SNAPSHOT 8 | Allure Report Test First Child 9 | 10 | 11 | io.qameta.allure-maven.it 12 | allure-maven-it 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module-exclude-report/first/target/allure-results/first-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.First 5 | 6 | 7 | firstTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module-exclude-report/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | pom 9 | 1.0-SNAPSHOT 10 | Allure Report Test 11 | 12 | 13 | UTF-8 14 | UTF-8 15 | 16 | 17 | 18 | first 19 | second 20 | 21 | 22 | 23 | true 24 | 25 | 26 | @project.groupId@ 27 | @project.artifactId@ 28 | @project.version@ 29 | 30 | 31 | 32 | 33 | 34 | 35 | aggregate 36 | false 37 | 38 | aggregate 39 | 40 | 41 | 42 | 43 | 2.30.0 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module-exclude-report/second/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | allure-maven-it-second-child 7 | 1.0-SNAPSHOT 8 | Allure Report Test Second Child 9 | 10 | 11 | io.qameta.allure-maven.it 12 | allure-maven-it 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module-exclude-report/second/target/allure-results/second-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Second 5 | 6 | 7 | secondTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module-exclude-report/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 6 | checkReportDirectory(outputDirectory, 2) -------------------------------------------------------------------------------- /src/it/aggregate-multi-module/first/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | allure-maven-it-first-child 7 | 1.0-SNAPSHOT 8 | Allure Report Test First Child 9 | 10 | 11 | io.qameta.allure-maven.it 12 | allure-maven-it 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module/first/target/allure-results/first-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.First 5 | 6 | 7 | firstTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | pom 9 | 1.0-SNAPSHOT 10 | Allure Report Test 11 | 12 | 13 | UTF-8 14 | UTF-8 15 | 16 | 17 | 18 | first 19 | second 20 | 21 | 22 | 23 | true 24 | 25 | 26 | @project.groupId@ 27 | @project.artifactId@ 28 | @project.version@ 29 | 30 | 31 | aggregate 32 | true 33 | 34 | aggregate 35 | 36 | 37 | 38 | 39 | 2.30.0 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module/second/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | allure-maven-it-second-child 7 | 1.0-SNAPSHOT 8 | Allure Report Test Second Child 9 | 10 | 11 | io.qameta.allure-maven.it 12 | allure-maven-it 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module/second/target/allure-results/second-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Second 5 | 6 | 7 | secondTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/aggregate-multi-module/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def basedirPath = basedir.absolutePath 6 | def outputDirectory = Paths.get(basedirPath, 'target', 'site', 'allure-maven-plugin') 7 | 8 | checkReportDirectory(outputDirectory, 2) 9 | -------------------------------------------------------------------------------- /src/it/aggregate-sample/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 25 | 26 | aggregate 27 | 28 | 29 | 30 | 31 | 2.30.0 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/it/aggregate-sample/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/aggregate-sample/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 6 | checkReportDirectory(outputDirectory, 1) -------------------------------------------------------------------------------- /src/it/allure-2-results/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 2.30.0 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/it/allure-2-results/target/allure-results/sample-testsuite.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "other.PassingTest", 3 | "title": "Passing test", 4 | "start": 1412949538848, 5 | "stop": 1412949560045, 6 | "version": "1.4.4-SNAPSHOT", 7 | "testCases": [ 8 | { 9 | "name": "testPassed", 10 | "start": 1412949529363, 11 | "stop": 1412949549730, 12 | "status": "PASSED", 13 | "labels": [ 14 | { 15 | "name": "issue", 16 | "value": "JIRA-15" 17 | }, 18 | { 19 | "name": "testId", 20 | "value": "TMS-1" 21 | }, 22 | { 23 | "name": "story", 24 | "value": "OtherStory" 25 | } 26 | ] 27 | } 28 | ], 29 | "labels": [ 30 | { 31 | "name": "story", 32 | "value": "SuccessStory" 33 | }, 34 | { 35 | "name": "story", 36 | "value": "OtherStory" 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /src/it/allure-2-results/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 6 | checkReportDirectory(outputDirectory, 1) -------------------------------------------------------------------------------- /src/it/categories-file-support-test-classpath/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 2.30.0 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/it/categories-file-support-test-classpath/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | simpleFaildTest 14 | 15 | AssertionError: 16 | Expected: is <3> 17 | but: was <2> 18 | java.lang.AssertionError: 19 | Expected: is <3> 20 | but: was <2> 21 | at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) 22 | at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) 23 | at my.company.tests.SimpleTest.simpleFaildTest(SimpleTest.java:51) 24 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 25 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 26 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 27 | at java.lang.reflect.Method.invoke(Method.java:497) 28 | at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 29 | at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 30 | at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 31 | at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 32 | at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 33 | at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 34 | at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 35 | at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 36 | at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 37 | at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 38 | at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 39 | at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 40 | at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 41 | at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367) 42 | at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274) 43 | at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) 44 | at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161) 45 | at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) 46 | at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) 47 | at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/categories-file-support-test-classpath/target/test-classes/categories.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Ignored tests", 4 | "messageRegex": ".*ignored.*", 5 | "matchedStatuses": [ "skipped" ] 6 | }, 7 | { 8 | "name": "Infrastructure problems", 9 | "traceRegex": ".*RuntimeException.*", 10 | "matchedStatuses": [ "broken", "failed" ] 11 | }, 12 | { 13 | "name": "Outdated tests", 14 | "messageRegex": ".*FileNotFound.*", 15 | "matchedStatuses": [ 16 | "broken" 17 | ] 18 | }, 19 | { 20 | "name": "Passed", 21 | "messageRegex": ".*", 22 | "matchedStatuses": [ "passed" ] 23 | } 24 | ] -------------------------------------------------------------------------------- /src/it/categories-file-support-test-classpath/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | 7 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 8 | checkReportDirectory(outputDirectory, 2) 9 | 10 | def dataDirectory = outputDirectory.resolve('data') 11 | 12 | def cateforiesPath = dataDirectory.resolve("categories.json") 13 | 14 | def jsonSlurper = new JsonSlurper() 15 | def categories = jsonSlurper.parseText(cateforiesPath.text) 16 | 17 | assert categories.children.size == 1 -------------------------------------------------------------------------------- /src/it/custom-url-report/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 2.30.0 25 | https://github.com/allure-framework/allure2/releases/download/2.30.0/allure-2.30.0.zip 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/custom-url-report/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/custom-url-report/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def base = Paths.get(basedir.absolutePath, 'target', 'site') 6 | 7 | checkReportDirectory(base.resolve('allure-maven-plugin'), 1) 8 | -------------------------------------------------------------------------------- /src/it/feature-plugins-support/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | pom 9 | 1.0-SNAPSHOT 10 | Allure Report Test 11 | 12 | 13 | UTF-8 14 | UTF-8 15 | 16 | 17 | 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 25 | 26 | ru.yandex.qatools.allure 27 | allure-report-plugin-api 28 | ${allure.version} 29 | 30 | 31 | 2.30.0 32 | 33 | 34 | 35 | org.apache.maven.plugins 36 | maven-project-info-reports-plugin 37 | 2.9 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/it/feature-plugins-support/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/feature-plugins-support/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 6 | checkReportDirectory(outputDirectory, 1) -------------------------------------------------------------------------------- /src/it/feature-should-fail-if-empty-report/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = success -------------------------------------------------------------------------------- /src/it/feature-should-fail-if-empty-report/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | pom 9 | 1.0-SNAPSHOT 10 | Allure Report Test 11 | 12 | 13 | UTF-8 14 | UTF-8 15 | 16 | 17 | 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 2.30.0 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-project-info-reports-plugin 30 | 2.9 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/it/feature-should-fail-if-empty-report/target/allure-results/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allure-framework/allure-maven/35fd212a6585a8d5e14e16e704f08cb7b1f8f607/src/it/feature-should-fail-if-empty-report/target/allure-results/.gitkeep -------------------------------------------------------------------------------- /src/it/feature-without-version-property/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | pom 9 | 1.0-SNAPSHOT 10 | Allure Report Test 11 | 12 | 13 | UTF-8 14 | UTF-8 15 | 16 | 17 | 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 25 | org.apache.maven.plugins 26 | maven-project-info-reports-plugin 27 | 2.9 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/it/feature-without-version-property/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/feature-without-version-property/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def basedirPath = basedir.absolutePath 6 | def outputDirectory = Paths.get(basedirPath, 'target', 'site', 'allure-maven-plugin') 7 | 8 | checkReportDirectory(outputDirectory, 1) -------------------------------------------------------------------------------- /src/it/input-directory-sample/first/first-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.First 5 | 6 | 7 | firstTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/input-directory-sample/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | first/,second/ 25 | 2.30.0 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/input-directory-sample/second/second-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Second 5 | 6 | 7 | secondTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/input-directory-sample/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 6 | checkReportDirectory(outputDirectory, 2) -------------------------------------------------------------------------------- /src/it/properties-file-support-compile-classpath/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 2.30.0 25 | allure.properties 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/properties-file-support-compile-classpath/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/properties-file-support-compile-classpath/target/classes/allure.properties: -------------------------------------------------------------------------------- 1 | allure.issues.tracker.pattern=http://example.com/%s 2 | -------------------------------------------------------------------------------- /src/it/properties-file-support-compile-classpath/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | import static io.qameta.allure.maven.TestHelper.getTestCases 7 | 8 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 9 | checkReportDirectory(outputDirectory, 1) 10 | 11 | def dataDirectory = outputDirectory.resolve('data') 12 | def testCasesDirectory = dataDirectory.resolve('test-cases') 13 | 14 | def testCasePath = testCasesDirectory.resolve(getTestCases(testCasesDirectory).get(0)) 15 | 16 | def jsonSlurper = new JsonSlurper() 17 | def testCase = jsonSlurper.parseText(testCasePath.text) 18 | 19 | assert testCase.links 20 | assert testCase.links.size() == 1 21 | 22 | def link = testCase.links.get(0) 23 | 24 | assert link 25 | assert link.name == "issue-123" 26 | assert link.url == "http://example.com/issue-123" -------------------------------------------------------------------------------- /src/it/properties-file-support-configuration/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 25 | http://example.com/%s 26 | 27 | 2.30.0 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/it/properties-file-support-configuration/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/properties-file-support-configuration/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | import static io.qameta.allure.maven.TestHelper.getTestCases 7 | 8 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 9 | checkReportDirectory(outputDirectory, 1) 10 | 11 | def dataDirectory = outputDirectory.resolve('data') 12 | def testCasesDirectory = dataDirectory.resolve('test-cases') 13 | 14 | def testCasePath = testCasesDirectory.resolve(getTestCases(testCasesDirectory).get(0)) 15 | 16 | def jsonSlurper = new JsonSlurper() 17 | def testCase = jsonSlurper.parseText(testCasePath.text) 18 | 19 | assert testCase.links 20 | assert testCase.links.size() == 1 21 | 22 | def link = testCase.links.get(0) 23 | 24 | assert link 25 | assert link.name == "issue-123" 26 | assert link.url == "http://example.com/issue-123" -------------------------------------------------------------------------------- /src/it/properties-file-support-default-location/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | 2.30.0 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/it/properties-file-support-default-location/report.properties: -------------------------------------------------------------------------------- 1 | allure.issues.tracker.pattern=http://example.com/%s -------------------------------------------------------------------------------- /src/it/properties-file-support-default-location/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/properties-file-support-default-location/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | import static io.qameta.allure.maven.TestHelper.getTestCases 7 | 8 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 9 | checkReportDirectory(outputDirectory, 1) 10 | 11 | def dataDirectory = outputDirectory.resolve('data') 12 | def testCasesDirectory = dataDirectory.resolve('test-cases') 13 | 14 | def testCasePath = testCasesDirectory.resolve(getTestCases(testCasesDirectory).get(0)) 15 | 16 | def jsonSlurper = new JsonSlurper() 17 | def testCase = jsonSlurper.parseText(testCasePath.text) 18 | 19 | assert testCase.links 20 | assert testCase.links.size() == 1 21 | 22 | def link = testCase.links.get(0) 23 | 24 | assert link 25 | assert link.name == "issue-123" 26 | assert link.url == "http://example.com/issue-123" -------------------------------------------------------------------------------- /src/it/properties-file-support-placeholder/allure.properties: -------------------------------------------------------------------------------- 1 | issues.tracker.host = example.com 2 | allure.issues.tracker.pattern=http://${issues.tracker.host}/%s 3 | allure.results.directory=${buildDir}/allure-results 4 | -------------------------------------------------------------------------------- /src/it/properties-file-support-placeholder/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | ${project.build.directory} 15 | 16 | 17 | 18 | true 19 | 20 | 21 | @project.groupId@ 22 | @project.artifactId@ 23 | @project.version@ 24 | 25 | allure.properties 26 | 2.30.0 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/it/properties-file-support-placeholder/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/properties-file-support-placeholder/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | import static io.qameta.allure.maven.TestHelper.getTestCases 7 | 8 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 9 | checkReportDirectory(outputDirectory, 1) 10 | 11 | def dataDirectory = outputDirectory.resolve('data') 12 | def testCasesDirectory = dataDirectory.resolve('test-cases') 13 | 14 | def testCasePath = testCasesDirectory.resolve(getTestCases(testCasesDirectory).get(0)) 15 | 16 | def jsonSlurper = new JsonSlurper() 17 | def testCase = jsonSlurper.parseText(testCasePath.text) 18 | 19 | assert testCase.links 20 | assert testCase.links.size() == 1 21 | 22 | def link = testCase.links.get(0) 23 | 24 | assert link 25 | assert link.name == "issue-123" 26 | assert link.url == "http://example.com/issue-123" -------------------------------------------------------------------------------- /src/it/properties-file-support-test-classpath/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | allure.properties 25 | 2.30.0 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/properties-file-support-test-classpath/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/properties-file-support-test-classpath/target/test-classes/report.properties: -------------------------------------------------------------------------------- 1 | allure.issues.tracker.pattern=http://example.com/%s -------------------------------------------------------------------------------- /src/it/properties-file-support-test-classpath/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | import static io.qameta.allure.maven.TestHelper.getTestCases 7 | 8 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 9 | checkReportDirectory(outputDirectory, 1) 10 | 11 | def dataDirectory = outputDirectory.resolve('data') 12 | def testCasesDirectory = dataDirectory.resolve('test-cases') 13 | 14 | def testCasePath = testCasesDirectory.resolve(getTestCases(testCasesDirectory).get(0)) 15 | 16 | def jsonSlurper = new JsonSlurper() 17 | def testCase = jsonSlurper.parseText(testCasePath.text) 18 | 19 | assert testCase.links 20 | assert testCase.links.size() == 1 21 | 22 | def link = testCase.links.get(0) 23 | 24 | assert link 25 | assert link.name == "issue-123" 26 | assert link.url == "http://example.com/issue-123" -------------------------------------------------------------------------------- /src/it/properties-file-support/allure.properties: -------------------------------------------------------------------------------- 1 | allure.issues.tracker.pattern=http://example.com/%s -------------------------------------------------------------------------------- /src/it/properties-file-support/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | allure.properties 25 | 2.30.0 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/properties-file-support/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/properties-file-support/verify.groovy: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | import java.nio.file.Paths 4 | 5 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 6 | import static io.qameta.allure.maven.TestHelper.getTestCases 7 | 8 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 9 | checkReportDirectory(outputDirectory, 1) 10 | 11 | def dataDirectory = outputDirectory.resolve('data') 12 | def testCasesDirectory = dataDirectory.resolve('test-cases') 13 | 14 | def testCasePath = testCasesDirectory.resolve(getTestCases(testCasesDirectory).get(0)) 15 | 16 | def jsonSlurper = new JsonSlurper() 17 | def testCase = jsonSlurper.parseText(testCasePath.text) 18 | 19 | assert testCase.links 20 | assert testCase.links.size() == 1 21 | 22 | def link = testCase.links.get(0) 23 | 24 | assert link 25 | assert link.name == "issue-123" 26 | assert link.url == "http://example.com/issue-123" -------------------------------------------------------------------------------- /src/it/report-as-build-plugin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | @project.groupId@ 20 | @project.artifactId@ 21 | @project.version@ 22 | 23 | 24 | site 25 | report 26 | 27 | 28 | 29 | ${project.build.directory}/site/allure 30 | 2.30.0 31 | 32 | 33 | 34 | 35 | 36 | 37 | true 38 | 39 | 40 | @project.groupId@ 41 | @project.artifactId@ 42 | @project.version@ 43 | 44 | 2.30.0 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/it/report-as-build-plugin/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-as-build-plugin/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def base = Paths.get(basedir.absolutePath, 'target', 'site') 6 | 7 | checkReportDirectory(base.resolve('allure'), 1) 8 | checkReportDirectory(base.resolve('allure-maven-plugin'), 1) 9 | -------------------------------------------------------------------------------- /src/it/report-change-report-directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | ${project.build.directory}/allure 25 | 2.30.0 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/report-change-report-directory/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-change-report-directory/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'allure') 6 | checkReportDirectory(outputDirectory, 1) -------------------------------------------------------------------------------- /src/it/report-change-results-directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | true 18 | 19 | 20 | @project.groupId@ 21 | @project.artifactId@ 22 | @project.version@ 23 | 24 | my-results 25 | 2.30.0 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/it/report-change-results-directory/target/my-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-change-results-directory/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def outputDirectory = Paths.get(basedir.absolutePath, 'target', 'site', 'allure-maven-plugin') 6 | checkReportDirectory(outputDirectory, 1) -------------------------------------------------------------------------------- /src/it/report-multi-module/first/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | allure-maven-it-first-child 7 | 1.0-SNAPSHOT 8 | Allure Report Test First Child 9 | 10 | 11 | io.qameta.allure-maven.it 12 | allure-maven-it 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/report-multi-module/first/target/allure-results/first-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.First 5 | 6 | 7 | firstTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-multi-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | pom 9 | 1.0-SNAPSHOT 10 | Allure Report Test 11 | 12 | 13 | UTF-8 14 | UTF-8 15 | 16 | 17 | 18 | first 19 | second 20 | 21 | 22 | 23 | true 24 | 25 | 26 | @project.groupId@ 27 | @project.artifactId@ 28 | @project.version@ 29 | 30 | 2.30.0 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/it/report-multi-module/second/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | allure-maven-it-second-child 7 | 1.0-SNAPSHOT 8 | Allure Report Test Second Child 9 | 10 | 11 | io.qameta.allure-maven.it 12 | allure-maven-it 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/report-multi-module/second/target/allure-results/second-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Second 5 | 6 | 7 | secondTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-multi-module/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def basedirPath = basedir.absolutePath 6 | def firstOutputDirectory = Paths.get(basedirPath, 'first', 'target', 'site', 'allure-maven-plugin') 7 | def secondOutputDirectory = Paths.get(basedirPath, 'second', 'target', 'site', 'allure-maven-plugin') 8 | 9 | checkReportDirectory(firstOutputDirectory, 1) 10 | checkReportDirectory(secondOutputDirectory, 1) 11 | -------------------------------------------------------------------------------- /src/it/report-single-file/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | @project.groupId@ 20 | @project.artifactId@ 21 | @project.version@ 22 | 23 | 24 | site 25 | report 26 | 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | true 37 | 38 | 39 | @project.groupId@ 40 | @project.artifactId@ 41 | @project.version@ 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/it/report-single-file/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-single-file/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkSingleFile 4 | 5 | def base = Paths.get(basedir.absolutePath, 'target', 'site') 6 | 7 | checkSingleFile(base.resolve('allure-maven-plugin')) 8 | -------------------------------------------------------------------------------- /src/it/report-with-bundled-version/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.qameta.allure-maven.it 7 | allure-maven-it 8 | 1.0-SNAPSHOT 9 | Allure Report Test 10 | 11 | 12 | UTF-8 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | @project.groupId@ 20 | @project.artifactId@ 21 | @project.version@ 22 | 23 | 24 | site 25 | report 26 | 27 | 28 | 29 | ${project.build.directory}/site/allure 30 | 2.30.0 31 | 32 | 33 | 34 | 35 | 36 | 37 | true 38 | 39 | 40 | @project.groupId@ 41 | @project.artifactId@ 42 | @project.version@ 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/it/report-with-bundled-version/target/allure-results/sample-testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | my.company.Sample 5 | 6 | 7 | sampleTestCase 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/it/report-with-bundled-version/verify.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.file.Paths 2 | 3 | import static io.qameta.allure.maven.TestHelper.checkReportDirectory 4 | 5 | def base = Paths.get(basedir.absolutePath, 'target', 'site') 6 | 7 | checkReportDirectory(base.resolve('allure'), 1) 8 | checkReportDirectory(base.resolve('allure-maven-plugin'), 1) 9 | -------------------------------------------------------------------------------- /src/it/settings.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | it-repo 6 | 7 | true 8 | 9 | 10 | 11 | local.central 12 | @localRepositoryUrl@ 13 | 14 | true 15 | 16 | 17 | true 18 | 19 | 20 | 21 | 22 | 23 | local.central 24 | @localRepositoryUrl@ 25 | 26 | true 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureAggregateMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import org.apache.maven.plugins.annotations.LifecyclePhase; 19 | import org.apache.maven.plugins.annotations.Mojo; 20 | import org.apache.maven.plugins.annotations.Parameter; 21 | import org.apache.maven.project.MavenProject; 22 | 23 | import java.nio.file.Path; 24 | import java.nio.file.Paths; 25 | import java.util.ArrayList; 26 | import java.util.Collections; 27 | import java.util.List; 28 | 29 | /** 30 | * @author Dmitry Baev dmitry.baev@qameta.io Date: 04.08.15 31 | */ 32 | @Mojo(name = "aggregate", defaultPhase = LifecyclePhase.SITE, inheritByDefault = false, 33 | aggregator = true) 34 | public class AllureAggregateMojo extends AllureGenerateMojo { 35 | 36 | /** 37 | * The projects in the reactor. 38 | */ 39 | @Parameter(defaultValue = "${reactorProjects}", required = true, readonly = true) 40 | protected List reactorProjects; 41 | 42 | /** 43 | * {@inheritDoc} 44 | */ 45 | @Override 46 | protected List getInputDirectories() { 47 | final Path relative = Paths.get(resultsDirectory); 48 | if (relative.isAbsolute()) { 49 | getLog().error("Input directory should be not absolute for aggregate goal."); 50 | return Collections.emptyList(); 51 | } 52 | 53 | final List result = new ArrayList<>(); 54 | for (MavenProject child : reactorProjects) { 55 | final Path target = Paths.get(child.getBuild().getDirectory()); 56 | final Path path = target.resolve(relative).toAbsolutePath(); 57 | if (isDirectoryExists(path)) { 58 | result.add(path); 59 | getLog().info("Found results directory " + path); 60 | } else { 61 | getLog().warn("Results directory for module " + child.getName() + " not found."); 62 | } 63 | } 64 | 65 | return result; 66 | } 67 | 68 | @Override 69 | protected String getMojoName() { 70 | return "aggregate"; 71 | } 72 | 73 | @Override 74 | protected boolean isAggregate() { 75 | return true; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureBaseMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import org.apache.maven.doxia.siterenderer.Renderer; 19 | import org.apache.maven.plugin.descriptor.PluginDescriptor; 20 | import org.apache.maven.plugins.annotations.Parameter; 21 | import org.apache.maven.project.MavenProject; 22 | import org.apache.maven.reporting.AbstractMavenReport; 23 | 24 | import java.util.Locale; 25 | 26 | /** 27 | * @author Dmitry Baev dmitry.baev@qameta.io Date: 30.07.15 28 | */ 29 | public abstract class AllureBaseMojo extends AbstractMavenReport { 30 | 31 | @Parameter(defaultValue = "${plugin}", readonly = true) 32 | protected PluginDescriptor pluginDescriptor; 33 | 34 | /** 35 | * {@inheritDoc} 36 | */ 37 | @Override 38 | protected Renderer getSiteRenderer() { 39 | return siteRenderer; 40 | } 41 | 42 | /** 43 | * {@inheritDoc} 44 | */ 45 | @Override 46 | protected MavenProject getProject() { 47 | return project; 48 | } 49 | 50 | /** 51 | * {@inheritDoc} 52 | */ 53 | @Override 54 | public String getOutputName() { 55 | return pluginDescriptor.getArtifactId(); 56 | } 57 | 58 | /** 59 | * {@inheritDoc} 60 | */ 61 | @Override 62 | public String getName(final Locale locale) { 63 | return "Allure"; 64 | } 65 | 66 | /** 67 | * {@inheritDoc} 68 | */ 69 | @Override 70 | public String getDescription(final Locale locale) { 71 | return "Extended report on the test results of the project."; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureCommandline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import net.lingala.zip4j.ZipFile; 19 | import net.lingala.zip4j.exception.ZipException; 20 | import org.apache.commons.exec.CommandLine; 21 | import org.apache.commons.exec.DefaultExecutor; 22 | import org.apache.commons.exec.ExecuteWatchdog; 23 | import org.apache.commons.io.FileUtils; 24 | import org.apache.commons.lang3.StringUtils; 25 | import org.apache.maven.execution.MavenSession; 26 | import org.apache.maven.model.Dependency; 27 | import org.apache.maven.project.DefaultProjectBuildingRequest; 28 | import org.apache.maven.project.ProjectBuildingRequest; 29 | import org.apache.maven.settings.Proxy; 30 | import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult; 31 | import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver; 32 | import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException; 33 | 34 | import java.io.File; 35 | import java.io.FileNotFoundException; 36 | import java.io.IOException; 37 | import java.io.InputStream; 38 | import java.net.Authenticator; 39 | import java.net.InetSocketAddress; 40 | import java.net.PasswordAuthentication; 41 | import java.net.URL; 42 | import java.nio.file.Files; 43 | import java.nio.file.Path; 44 | import java.nio.file.StandardCopyOption; 45 | import java.time.Duration; 46 | import java.util.Collections; 47 | import java.util.Iterator; 48 | import java.util.List; 49 | import java.util.Objects; 50 | import java.util.concurrent.TimeUnit; 51 | 52 | import static io.qameta.allure.maven.VersionUtils.versionCompare; 53 | 54 | @SuppressWarnings({"PMD.GodClass", "ClassDataAbstractionCoupling", "ClassFanOutComplexity", 55 | "MultipleStringLiterals"}) 56 | public class AllureCommandline { 57 | 58 | public static final String ALLURE_DEFAULT_VERSION = "2.30.0"; 59 | 60 | private static final int DEFAULT_TIMEOUT = 3600; 61 | 62 | private final String version; 63 | 64 | private final int timeout; 65 | 66 | private final Path installationDirectory; 67 | 68 | public AllureCommandline(final Path installationDirectory, final String version) { 69 | this(installationDirectory, version, DEFAULT_TIMEOUT); 70 | } 71 | 72 | public AllureCommandline(final Path installationDirectory, final String version, 73 | final int timeout) { 74 | this.installationDirectory = installationDirectory; 75 | this.version = StringUtils.isBlank(version) || versionCompare(version, "2.8.0") < 0 76 | ? ALLURE_DEFAULT_VERSION 77 | : version; 78 | this.timeout = timeout; 79 | } 80 | 81 | public int generateReport(final List resultsPaths, final Path reportPath, 82 | final boolean singleFile) throws IOException { 83 | 84 | this.checkAllureExists(); 85 | 86 | FileUtils.deleteQuietly(reportPath.toFile()); 87 | 88 | final CommandLine commandLine = 89 | new CommandLine(getAllureExecutablePath().toAbsolutePath().toFile()); 90 | commandLine.addArgument("generate"); 91 | commandLine.addArgument("--clean"); 92 | if (singleFile) { 93 | commandLine.addArgument("--single-file"); 94 | } 95 | 96 | for (Path resultsPath : resultsPaths) { 97 | commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true); 98 | } 99 | commandLine.addArgument("-o"); 100 | commandLine.addArgument(reportPath.toAbsolutePath().toString(), true); 101 | 102 | return execute(commandLine, timeout); 103 | } 104 | 105 | public int serve(final List resultsPaths, final Path reportPath, final String serveHost, 106 | final Integer servePort) throws IOException { 107 | 108 | this.checkAllureExists(); 109 | 110 | FileUtils.deleteQuietly(reportPath.toFile()); 111 | 112 | final CommandLine commandLine = 113 | new CommandLine(getAllureExecutablePath().toAbsolutePath().toFile()); 114 | commandLine.addArgument("serve"); 115 | if (serveHost != null && serveHost.matches("(\\d{1,3}\\.){3}\\d{1,3}")) { 116 | commandLine.addArgument("--host"); 117 | commandLine.addArgument(serveHost); 118 | } 119 | if (servePort > 0) { 120 | commandLine.addArgument("--port"); 121 | commandLine.addArgument(Objects.toString(servePort)); 122 | } 123 | for (Path resultsPath : resultsPaths) { 124 | commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true); 125 | } 126 | return execute(commandLine, timeout); 127 | } 128 | 129 | private void checkAllureExists() throws FileNotFoundException { 130 | if (allureNotExists()) { 131 | throw new FileNotFoundException("There is no valid allure installation." 132 | + " Make sure you're using allure version not less then 2.x."); 133 | } 134 | } 135 | 136 | private int execute(final CommandLine commandLine, final int timeout) throws IOException { 137 | final DefaultExecutor executor = DefaultExecutor.builder().get(); 138 | final ExecuteWatchdog watchdog = ExecuteWatchdog.builder() 139 | .setTimeout(Duration.ofMillis(TimeUnit.SECONDS.toMillis(timeout))).get(); 140 | executor.setWatchdog(watchdog); 141 | executor.setExitValue(0); 142 | return executor.execute(commandLine); 143 | } 144 | 145 | private Path getAllureExecutablePath() { 146 | final String allureExecutable = isWindows() ? "allure.bat" : "allure"; 147 | return getAllureHome().resolve("bin").resolve(allureExecutable); 148 | } 149 | 150 | private Path getAllureHome() { 151 | return installationDirectory.resolve(String.format("allure-%s", version)); 152 | } 153 | 154 | public boolean allureExists() { 155 | final Path allureExecutablePath = getAllureExecutablePath(); 156 | return Files.exists(allureExecutablePath) && Files.isExecutable(allureExecutablePath); 157 | } 158 | 159 | public boolean allureNotExists() { 160 | return !allureExists(); 161 | } 162 | 163 | public void downloadWithMaven(final MavenSession session, 164 | final DependencyResolver dependencyResolver) throws IOException { 165 | final ProjectBuildingRequest buildingRequest = 166 | new DefaultProjectBuildingRequest(session.getProjectBuildingRequest()); 167 | buildingRequest.setResolveDependencies(false); 168 | 169 | final Dependency cliDep = new Dependency(); 170 | cliDep.setGroupId("io.qameta.allure"); 171 | cliDep.setArtifactId("allure-commandline"); 172 | cliDep.setVersion(version); 173 | cliDep.setType("zip"); 174 | 175 | try { 176 | final Iterator resolved = 177 | dependencyResolver.resolveDependencies(buildingRequest, 178 | Collections.singletonList(cliDep), null, null).iterator(); 179 | 180 | if (resolved.hasNext()) { 181 | unpack(resolved.next().getArtifact().getFile()); 182 | } else { 183 | throw new IOException("No allure commandline artifact found."); 184 | 185 | } 186 | } catch (DependencyResolverException e) { 187 | throw new IOException("Cannot resolve allure commandline dependencies.", e); 188 | } 189 | } 190 | 191 | public void download(final String allureDownloadUrl, final Proxy mavenProxy) 192 | throws IOException { 193 | if (allureExists()) { 194 | return; 195 | } 196 | 197 | final Path allureZip = Files.createTempFile("allure", version); 198 | final String allureUrl = String.format(allureDownloadUrl, version, version); 199 | final URL url = new URL(allureUrl); 200 | 201 | if (mavenProxy != null && version != null) { 202 | final InetSocketAddress proxyAddress = 203 | new InetSocketAddress(mavenProxy.getHost(), mavenProxy.getPort()); 204 | 205 | if (mavenProxy.getUsername() != null && mavenProxy.getPassword() != null) { 206 | final String proxyUser = mavenProxy.getUsername(); 207 | final String proxyPassword = mavenProxy.getPassword(); 208 | 209 | Authenticator.setDefault(new Authenticator() { 210 | @Override 211 | public PasswordAuthentication getPasswordAuthentication() { 212 | return new PasswordAuthentication(proxyUser, proxyPassword.toCharArray()); 213 | } 214 | }); 215 | } 216 | 217 | final java.net.Proxy proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, proxyAddress); 218 | final InputStream inputStream = url.openConnection(proxy).getInputStream(); 219 | Files.copy(inputStream, allureZip, StandardCopyOption.REPLACE_EXISTING); 220 | } else { 221 | FileUtils.copyURLToFile(url, allureZip.toFile()); 222 | } 223 | 224 | unpack(allureZip.toFile()); 225 | } 226 | 227 | private void unpack(final File file) throws IOException { 228 | try (ZipFile zipFile = new ZipFile(file)) { 229 | zipFile.extractAll(getInstallationDirectory().toAbsolutePath().toString()); 230 | } catch (ZipException e) { 231 | throw new IOException(e); 232 | } 233 | 234 | final Path allureExecutable = getAllureExecutablePath(); 235 | if (Files.exists(allureExecutable)) { 236 | allureExecutable.toFile().setExecutable(true); 237 | } 238 | } 239 | 240 | public Path getInstallationDirectory() { 241 | return installationDirectory; 242 | } 243 | 244 | public String getVersion() { 245 | return version; 246 | } 247 | 248 | private boolean isWindows() { 249 | return System.getProperty("os.name").toLowerCase().contains("win"); 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureGenerateMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import com.fasterxml.jackson.databind.ObjectMapper; 19 | import org.apache.commons.lang3.StringUtils; 20 | import org.apache.commons.text.StringSubstitutor; 21 | import org.apache.maven.artifact.DependencyResolutionRequiredException; 22 | import org.apache.maven.doxia.sink.Sink; 23 | import org.apache.maven.execution.MavenSession; 24 | import org.apache.maven.plugins.annotations.Component; 25 | import org.apache.maven.plugins.annotations.Parameter; 26 | import org.apache.maven.reporting.MavenReportException; 27 | import org.apache.maven.settings.crypto.SettingsDecrypter; 28 | import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver; 29 | 30 | import java.io.IOException; 31 | import java.io.InputStream; 32 | import java.io.OutputStream; 33 | import java.net.MalformedURLException; 34 | import java.net.URISyntaxException; 35 | import java.net.URL; 36 | import java.net.URLClassLoader; 37 | import java.nio.file.Files; 38 | import java.nio.file.Path; 39 | import java.nio.file.Paths; 40 | import java.nio.file.StandardCopyOption; 41 | import java.util.ArrayList; 42 | import java.util.Collections; 43 | import java.util.HashMap; 44 | import java.util.List; 45 | import java.util.Locale; 46 | import java.util.Map; 47 | import java.util.Properties; 48 | 49 | import static io.qameta.allure.maven.AllureCommandline.ALLURE_DEFAULT_VERSION; 50 | 51 | /** 52 | * @author Dmitry Baev dmitry.baev@qameta.io Date: 04.08.15 53 | */ 54 | @SuppressWarnings({"PMD.GodClass", "ClassFanOutComplexity"}) 55 | public abstract class AllureGenerateMojo extends AllureBaseMojo { 56 | 57 | public static final String ALLURE_OLD_PROPERTIES = "allure.properties"; 58 | 59 | public static final String ALLURE_NEW_PROPERTIES = "report.properties"; 60 | 61 | public static final String CATEGORIES_FILE_NAME = "categories.json"; 62 | 63 | /** 64 | * The project build directory. For maven projects it is usually the target folder. 65 | */ 66 | @Parameter(defaultValue = "${project.build.directory}", readonly = true) 67 | protected String buildDirectory; 68 | 69 | /** 70 | * The project reporting output directory. For maven projects it is usually the target/site 71 | * folder. 72 | */ 73 | @Parameter(defaultValue = "${project.reporting.outputDirectory}", readonly = true) 74 | protected String reportingOutputDirectory; 75 | 76 | /** 77 | * The path to Allure results directory. In general it is the directory created by allure 78 | * adaptor and contains allure xml files and attachments. This path can be relative from build 79 | * directory (for maven it is the target directory) or absolute (absolute only for 80 | * report mojo). Will be ignored for bulk mojo. 81 | */ 82 | @Parameter(property = "allure.results.directory", defaultValue = "allure-results/") 83 | protected String resultsDirectory; 84 | 85 | /** 86 | * The version on Allure report to generate. 87 | */ 88 | @Parameter(property = "report.version") 89 | protected String reportVersion; 90 | 91 | @Parameter(property = "allure.report.directory", 92 | defaultValue = "${project.reporting.outputDirectory}/allure-maven-plugin") 93 | protected String reportDirectory; 94 | 95 | /** 96 | * Report timeout parameter in seconds. 97 | */ 98 | @Parameter(property = "allure.report.timeout", defaultValue = "60") 99 | protected int reportTimeout; 100 | 101 | /** 102 | * This is key-value map which defines executor.json file content. Default content: 103 | * {"buildName":"${project.name}","name":"Maven","type":"maven"} 104 | */ 105 | @Parameter 106 | protected final Map executorInfo = new HashMap<>(); 107 | 108 | /** 109 | * The path to the allure.properties file. 110 | */ 111 | @Parameter(defaultValue = "report.properties") 112 | protected String propertiesFilePath; 113 | 114 | @Parameter(property = "allure.install.directory", defaultValue = "${project.basedir}/.allure") 115 | protected String installDirectory; 116 | 117 | @Parameter(property = "allure.download.url") 118 | protected String allureDownloadUrl; 119 | 120 | @Parameter(property = "session", defaultValue = "${session}", readonly = true) 121 | protected MavenSession session; 122 | 123 | @Component(role = SettingsDecrypter.class) 124 | protected SettingsDecrypter decrypter; 125 | 126 | @Component 127 | protected DependencyResolver dependencyResolver; 128 | 129 | /** 130 | * The additional Allure properties such as issue tracker pattern. 131 | */ 132 | @Parameter 133 | protected Map properties = new HashMap<>(); 134 | 135 | /** 136 | * The report generation mode. 137 | */ 138 | @Parameter 139 | protected Boolean singleFile; 140 | 141 | /** 142 | * {@inheritDoc} 143 | */ 144 | @Override 145 | protected String getOutputDirectory() { 146 | return getReportDirectory(); 147 | } 148 | 149 | /** 150 | * {@inheritDoc} 151 | */ 152 | @Override 153 | protected void executeReport(final Locale locale) throws MavenReportException { 154 | try { 155 | 156 | this.installAllure(); 157 | 158 | getLog().info(String.format("Generate Allure report (%s) with version %s", 159 | getMojoName(), reportVersion != null ? reportVersion : ALLURE_DEFAULT_VERSION)); 160 | getLog().info("Generate Allure report to " + getReportDirectory()); 161 | 162 | final List inputDirectories = getInputDirectories(); 163 | 164 | if (inputDirectories.isEmpty()) { 165 | getLog().warn( 166 | "Allure report was skipped because there is no results directories found."); 167 | return; 168 | } 169 | 170 | this.loadProperties(inputDirectories); 171 | this.loadCategories(inputDirectories); 172 | this.copyExecutorInfo(inputDirectories); 173 | this.generateReport(inputDirectories); 174 | 175 | render(getSink(), getName(locale)); 176 | 177 | } catch (Exception e) { 178 | throw new MavenReportException("Could not generate the report", e); 179 | } 180 | } 181 | 182 | private void copyExecutorInfo(final List inputDirectories) throws IOException { 183 | addPropertyIfAbsent("name", "Maven"); 184 | addPropertyIfAbsent("type", "maven"); 185 | addPropertyIfAbsent("buildName", getProject() == null ? "N/A" : getProject().getName()); 186 | 187 | final ObjectMapper mapper = new ObjectMapper(); 188 | for (Path dir : inputDirectories) { 189 | final Path executorInfoFile = dir.resolve("executor.json"); 190 | mapper.writeValue(executorInfoFile.toFile(), executorInfo); 191 | } 192 | } 193 | 194 | private void addPropertyIfAbsent(final String key, final String value) { 195 | if (!executorInfo.containsKey(key)) { 196 | executorInfo.put(key, value); 197 | } 198 | } 199 | 200 | private void loadCategories(final List inputDirectories) 201 | throws URISyntaxException, IOException, DependencyResolutionRequiredException { 202 | final URL categoriesUrl = createProjectClassLoader().getResource(CATEGORIES_FILE_NAME); 203 | if (categoriesUrl == null) { 204 | getLog().info("Can't find information about categories"); 205 | return; 206 | } 207 | for (Path dir : inputDirectories) { 208 | final Path categories = Paths.get(categoriesUrl.toURI()); 209 | Files.copy(categories, dir.resolve(CATEGORIES_FILE_NAME), 210 | StandardCopyOption.REPLACE_EXISTING); 211 | } 212 | } 213 | 214 | private void loadProperties(final List inputDirectories) 215 | throws IOException, DependencyResolutionRequiredException { 216 | final Properties properties = new Properties(); 217 | readPropertiesFile(properties); 218 | readPropertiesFileFromClasspath(ALLURE_OLD_PROPERTIES, properties); 219 | readPropertiesFileFromClasspath(ALLURE_NEW_PROPERTIES, properties); 220 | readPropertiesFromMap(properties); 221 | prepareProperties(properties); 222 | for (Path dir : inputDirectories) { 223 | try (OutputStream os = Files.newOutputStream(dir.resolve(ALLURE_OLD_PROPERTIES))) { 224 | properties.store(os, null); 225 | } catch (IOException e) { 226 | getLog().info( 227 | String.format("Can't store properties in directory %s", dir.toString()), e); 228 | } 229 | } 230 | } 231 | 232 | private void installAllure() throws MavenReportException { 233 | try { 234 | final AllureCommandline commandline = 235 | new AllureCommandline(Paths.get(installDirectory), reportVersion); 236 | getLog().info(String.format("Allure installation directory %s", installDirectory)); 237 | getLog().info(String.format("Try to finding out allure %s", commandline.getVersion())); 238 | 239 | if (commandline.allureNotExists()) { 240 | if (StringUtils.isNotBlank(allureDownloadUrl)) { 241 | getLog().info("Downloading allure commandline from " + allureDownloadUrl); 242 | commandline.download(allureDownloadUrl, 243 | ProxyUtils.getProxy(session, decrypter)); 244 | getLog().info("Downloading allure commandline complete"); 245 | } else { 246 | commandline.downloadWithMaven(session, dependencyResolver); 247 | } 248 | } 249 | } catch (IOException e) { 250 | getLog().error("Installation error", e); 251 | throw new MavenReportException("Can't install allure", e); 252 | } 253 | } 254 | 255 | protected void generateReport(final List resultsPaths) throws MavenReportException { 256 | try { 257 | final Path reportPath = Paths.get(getReportDirectory()); 258 | 259 | final AllureCommandline commandline = new AllureCommandline( 260 | Paths.get(getInstallDirectory()), reportVersion, reportTimeout); 261 | 262 | getLog().info("Generate report to " + reportPath); 263 | commandline.generateReport(resultsPaths, reportPath, Boolean.TRUE.equals(singleFile)); 264 | getLog().info("Report generated successfully."); 265 | } catch (Exception e) { 266 | getLog().error("Generation error", e); 267 | throw new MavenReportException("Can't generate allure report data", e); 268 | } 269 | } 270 | 271 | /** 272 | * Read system properties from file {@link #propertiesFilePath}. 273 | * 274 | * @throws IOException if any occurs. 275 | */ 276 | protected void readPropertiesFile(final Properties properties) throws IOException { 277 | final Path path = Paths.get(propertiesFilePath); 278 | if (Files.exists(path)) { 279 | try (InputStream is = Files.newInputStream(path)) { 280 | properties.load(is); 281 | } 282 | } 283 | } 284 | 285 | /** 286 | * Read allure.properties from classpath. 287 | * 288 | * @throws IOException if any occurs. 289 | */ 290 | protected void readPropertiesFileFromClasspath(final String propertiesFileName, 291 | final Properties properties) throws IOException, DependencyResolutionRequiredException { 292 | try (InputStream is = createProjectClassLoader().getResourceAsStream(propertiesFileName)) { 293 | if (is != null) { 294 | properties.load(is); 295 | } 296 | } 297 | } 298 | 299 | /** 300 | * Set properties from {@link #properties}. 301 | */ 302 | protected void readPropertiesFromMap(final Properties properties) { 303 | for (Map.Entry property : this.properties.entrySet()) { 304 | if (property.getKey() != null && property.getValue() != null) { 305 | properties.setProperty(property.getKey(), property.getValue()); 306 | } 307 | } 308 | } 309 | 310 | /** 311 | * Replaces the placeholders in properties. You can use properties like: name1=value1 312 | * name2=value2 with ${name1} You can also use system and maven properties for the placeholder. 313 | */ 314 | protected void prepareProperties(final Properties properties) { 315 | final Properties allProperties = new Properties(); 316 | allProperties.putAll(properties); 317 | allProperties.putAll( 318 | getProject() == null ? Collections.emptyMap() : getProject().getProperties()); 319 | allProperties.putAll(System.getProperties()); 320 | for (String name : properties.stringPropertyNames()) { 321 | properties.setProperty(name, 322 | StringSubstitutor.replace(properties.getProperty(name), allProperties)); 323 | } 324 | } 325 | 326 | /** 327 | * Render allure report page in project-reports.html. 328 | */ 329 | protected void render(final Sink sink, final String title) { 330 | sink.head(); 331 | sink.title(); 332 | sink.text(title); 333 | sink.title_(); 334 | sink.head_(); 335 | sink.body(); 336 | 337 | sink.lineBreak(); 338 | 339 | final Path indexHtmlFile = Paths.get(getReportDirectory(), "index.html"); 340 | final String relativePath = 341 | Paths.get(reportingOutputDirectory).relativize(indexHtmlFile).toString(); 342 | 343 | sink.rawText(String.format("", 344 | relativePath)); 345 | 346 | sink.link(relativePath); 347 | 348 | sink.body_(); 349 | sink.flush(); 350 | sink.close(); 351 | } 352 | 353 | /** 354 | * Return ClassLoader with classpath elements. 355 | */ 356 | protected ClassLoader createProjectClassLoader() 357 | throws MalformedURLException, DependencyResolutionRequiredException { 358 | final List result = new ArrayList<>(); 359 | for (String element : project.getTestClasspathElements()) { 360 | if (element != null) { 361 | final URL url = Paths.get(element).toUri().toURL(); 362 | result.add(url); 363 | } 364 | } 365 | return new URLClassLoader(result.toArray(new URL[0])); 366 | } 367 | 368 | /** 369 | * {@inheritDoc} 370 | */ 371 | @Override 372 | public boolean canGenerateReport() { 373 | return !isAggregate() || project.isExecutionRoot(); 374 | } 375 | 376 | /** 377 | * Is the current report aggregated? 378 | */ 379 | protected boolean isAggregate() { 380 | return false; 381 | } 382 | 383 | /** 384 | * Returns true if given path is an existed directory. 385 | */ 386 | protected boolean isDirectoryExists(final Path path) { 387 | return Files.exists(path) && Files.isDirectory(path); 388 | } 389 | 390 | /** 391 | * Get list of Allure results directories to generate the report. 392 | */ 393 | protected abstract List getInputDirectories(); 394 | 395 | /** 396 | * Get the current mojo name. 397 | */ 398 | protected abstract String getMojoName(); 399 | 400 | /** 401 | * The directory to generate Allure report into. 402 | */ 403 | public String getReportDirectory() { 404 | return reportDirectory; 405 | } 406 | 407 | public String getInstallDirectory() { 408 | return installDirectory; 409 | } 410 | } 411 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureInstallMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import java.io.IOException; 19 | import java.nio.file.Paths; 20 | 21 | import org.apache.commons.lang3.StringUtils; 22 | import org.apache.maven.execution.MavenSession; 23 | import org.apache.maven.plugin.AbstractMojo; 24 | import org.apache.maven.plugin.MojoExecutionException; 25 | import org.apache.maven.plugins.annotations.Component; 26 | import org.apache.maven.plugins.annotations.LifecyclePhase; 27 | import org.apache.maven.plugins.annotations.Mojo; 28 | import org.apache.maven.plugins.annotations.Parameter; 29 | import org.apache.maven.settings.crypto.SettingsDecrypter; 30 | import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver; 31 | 32 | /** 33 | * Install allure tool. 34 | */ 35 | @SuppressWarnings("unused") 36 | @Mojo(name = "install", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) 37 | public class AllureInstallMojo extends AbstractMojo { 38 | 39 | @Parameter(property = "report.version") 40 | private String reportVersion; 41 | 42 | @Parameter(property = "allure.download.url") 43 | private String allureDownloadUrl; 44 | 45 | @Parameter(property = "allure.install.directory", defaultValue = "${project.basedir}/.allure") 46 | private String installDirectory; 47 | 48 | @Parameter(property = "session", defaultValue = "${session}", readonly = true) 49 | private MavenSession session; 50 | 51 | @Component(role = SettingsDecrypter.class) 52 | private SettingsDecrypter decrypter; 53 | 54 | @Component 55 | private DependencyResolver dependencyResolver; 56 | 57 | @Override 58 | public void execute() throws MojoExecutionException { 59 | try { 60 | final AllureCommandline commandline = 61 | new AllureCommandline(Paths.get(installDirectory), reportVersion); 62 | getLog().info(String.format("Allure installation directory %s", installDirectory)); 63 | getLog().info(String.format("Try to finding out allure %s", commandline.getVersion())); 64 | 65 | if (commandline.allureNotExists()) { 66 | if (StringUtils.isNotBlank(allureDownloadUrl)) { 67 | getLog().info("Downloading allure commandline from " + allureDownloadUrl); 68 | commandline.download(allureDownloadUrl, 69 | ProxyUtils.getProxy(session, decrypter)); 70 | getLog().info("Downloading allure commandline complete"); 71 | } else { 72 | commandline.downloadWithMaven(session, dependencyResolver); 73 | } 74 | } 75 | } catch (IOException e) { 76 | getLog().error("Installation error", e); 77 | throw new MojoExecutionException("Can't install allure", e); 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureReportMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import org.apache.commons.lang3.StringUtils; 19 | import org.apache.maven.plugins.annotations.LifecyclePhase; 20 | import org.apache.maven.plugins.annotations.Mojo; 21 | import org.apache.maven.plugins.annotations.Parameter; 22 | 23 | import java.nio.file.Path; 24 | import java.nio.file.Paths; 25 | import java.util.ArrayList; 26 | import java.util.Collections; 27 | import java.util.List; 28 | 29 | import static java.lang.String.format; 30 | 31 | /** 32 | * @author Dmitry Baev dmitry.baev@qameta.io Date: 30.07.15 33 | */ 34 | @Mojo(name = "report", defaultPhase = LifecyclePhase.SITE) 35 | public class AllureReportMojo extends AllureGenerateMojo { 36 | 37 | private static final String FOUND_DIRECTORY = "Found results directory %s"; 38 | private static final String DIRECTORY_NOT_FOUND = "Directory %s not found"; 39 | 40 | /** 41 | * The comma-separated list of additional input directories. As long as unix path can contains 42 | * commas it is bad way to specify few input directories. The main usage of this parameter is 43 | * some scripts to generate aggregated report. This parameter will be used only in "bulk" mojo. 44 | */ 45 | @Parameter(property = "allure.results.inputDirectories") 46 | protected String inputDirectories; 47 | 48 | /** 49 | * {@inheritDoc} 50 | */ 51 | @Override 52 | protected List getInputDirectories() { 53 | 54 | if (StringUtils.isNotBlank(inputDirectories)) { 55 | return fromInputDirectories(); 56 | } 57 | 58 | final Path path = getInputDirectoryAbsolutePath(); 59 | if (isDirectoryExists(path)) { 60 | getLog().info(format(FOUND_DIRECTORY, path)); 61 | return Collections.singletonList(path); 62 | } 63 | getLog().error(format(DIRECTORY_NOT_FOUND, path)); 64 | return Collections.emptyList(); 65 | } 66 | 67 | private List fromInputDirectories() { 68 | final List results = new ArrayList<>(); 69 | for (String dir : inputDirectories.split(",")) { 70 | final Path path = Paths.get(dir).toAbsolutePath(); 71 | if (isDirectoryExists(path)) { 72 | results.add(path); 73 | getLog().info(format(FOUND_DIRECTORY, path)); 74 | } else { 75 | getLog().error(format(DIRECTORY_NOT_FOUND, path)); 76 | } 77 | } 78 | return results; 79 | } 80 | 81 | @Override 82 | protected String getMojoName() { 83 | return "report"; 84 | } 85 | 86 | private Path getInputDirectoryAbsolutePath() { 87 | final Path path = Paths.get(resultsDirectory); 88 | return path.isAbsolute() ? path : Paths.get(buildDirectory).resolve(path); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/AllureServeMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import org.apache.maven.plugins.annotations.LifecyclePhase; 19 | import org.apache.maven.plugins.annotations.Mojo; 20 | import org.apache.maven.plugins.annotations.Parameter; 21 | import org.apache.maven.reporting.MavenReportException; 22 | 23 | import java.nio.file.Path; 24 | import java.nio.file.Paths; 25 | import java.util.Collections; 26 | import java.util.List; 27 | 28 | /** 29 | * Calls allure serve command. 30 | */ 31 | @SuppressWarnings("unused") 32 | @Mojo(name = "serve", defaultPhase = LifecyclePhase.SITE, inheritByDefault = false) 33 | public class AllureServeMojo extends AllureGenerateMojo { 34 | 35 | /** 36 | * Serve timeout parameter in seconds. 37 | */ 38 | @Parameter(property = "allure.serve.timeout", defaultValue = "3600") 39 | private int serveTimeout; 40 | 41 | /** 42 | * Serve host parameter. 43 | */ 44 | @Parameter(property = "allure.serve.host") 45 | private String serveHost; 46 | 47 | /** 48 | * Serve port parameter. 49 | */ 50 | @Parameter(property = "allure.serve.port", defaultValue = "0") 51 | private Integer servePort; 52 | 53 | /** 54 | * {@inheritDoc} 55 | */ 56 | @Override 57 | protected List getInputDirectories() { 58 | final Path path = getInputDirectoryAbsolutePath(); 59 | if (isDirectoryExists(path)) { 60 | getLog().info("Found results directory " + path); 61 | return Collections.singletonList(path); 62 | } 63 | getLog().error("Directory " + path + " not found."); 64 | return Collections.emptyList(); 65 | } 66 | 67 | private Path getInputDirectoryAbsolutePath() { 68 | final Path path = Paths.get(resultsDirectory); 69 | return path.isAbsolute() ? path : Paths.get(buildDirectory).resolve(path); 70 | } 71 | 72 | @Override 73 | protected void generateReport(final List resultsPaths) throws MavenReportException { 74 | try { 75 | final Path reportPath = Paths.get(getReportDirectory()); 76 | 77 | final AllureCommandline commandline = new AllureCommandline( 78 | Paths.get(getInstallDirectory()), reportVersion, this.serveTimeout); 79 | 80 | getLog().info("Generate report to " + reportPath); 81 | commandline.serve(resultsPaths, reportPath, this.serveHost, this.servePort); 82 | getLog().info("Report generated successfully."); 83 | } catch (Exception e) { 84 | getLog().error("Generate error", e); 85 | throw new MavenReportException("Can't generate allure report", e); 86 | } 87 | } 88 | 89 | @Override 90 | protected String getMojoName() { 91 | return "serve"; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/ProxyUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import org.apache.maven.execution.MavenSession; 19 | import org.apache.maven.settings.Proxy; 20 | import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; 21 | import org.apache.maven.settings.crypto.SettingsDecrypter; 22 | import org.apache.maven.settings.crypto.SettingsDecryptionResult; 23 | import org.slf4j.Logger; 24 | import org.slf4j.LoggerFactory; 25 | 26 | import java.io.IOException; 27 | import java.net.Socket; 28 | import java.util.List; 29 | 30 | /** 31 | * Created by bvo2002 on 25.05.17. 32 | */ 33 | final class ProxyUtils { 34 | 35 | private static final Logger LOGGER = LoggerFactory.getLogger(ProxyUtils.class); 36 | 37 | private ProxyUtils() { 38 | throw new IllegalStateException("Do not instance"); 39 | } 40 | 41 | @SuppressWarnings({"ModifiedControlVariable", "EmptyBlock", 42 | "PMD.AvoidInstantiatingObjectsInLoops", "PMD.EmptyControlStatement", 43 | "PMD.UnusedLocalVariable"}) 44 | public static Proxy getProxy(final MavenSession mavenSession, 45 | final SettingsDecrypter decrypter) { 46 | if (mavenSession == null || mavenSession.getSettings() == null 47 | || mavenSession.getSettings().getProxies() == null 48 | || mavenSession.getSettings().getProxies().isEmpty()) { 49 | LOGGER.info("Proxy is not specified."); 50 | } else { 51 | final List mavenProxies = mavenSession.getSettings().getProxies(); 52 | for (Proxy proxy : mavenProxies) { 53 | if (proxy.isActive()) { 54 | final Proxy decrypted = decryptProxy(proxy, decrypter); 55 | try (Socket socket = new Socket(decrypted.getHost(), decrypted.getPort())) { 56 | // do nothing 57 | } catch (IOException e) { 58 | LOGGER.info(String.format("Proxy: %s:%s is not available", 59 | decrypted.getHost(), decrypted.getPort())); 60 | continue; 61 | } 62 | LOGGER.info(String.format("Found proxy: %s:%s", decrypted.getHost(), 63 | decrypted.getPort())); 64 | return proxy; 65 | } 66 | } 67 | LOGGER.info("No active proxies found."); 68 | } 69 | return null; 70 | } 71 | 72 | private static Proxy decryptProxy(final Proxy proxy, final SettingsDecrypter decrypter) { 73 | final DefaultSettingsDecryptionRequest decryptionRequest = 74 | new DefaultSettingsDecryptionRequest(proxy); 75 | final SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest); 76 | return decryptedResult.getProxy(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/io/qameta/allure/maven/VersionUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | /** 19 | * @author eroshenkoam (Artem Eroshenko). 20 | */ 21 | public final class VersionUtils { 22 | 23 | private static final String BY_DOT = "\\."; 24 | 25 | private VersionUtils() { 26 | throw new IllegalStateException("do not instance"); 27 | } 28 | 29 | public static Integer versionCompare(final String first, final String second) { 30 | final String[] firstVersions = first.split(BY_DOT); 31 | final String[] secondVersions = second.split(BY_DOT); 32 | int i = 0; 33 | while (i < firstVersions.length && i < secondVersions.length 34 | && firstVersions[i].equals(secondVersions[i])) { 35 | i++; 36 | } 37 | if (i < firstVersions.length && i < secondVersions.length) { 38 | final int diff = 39 | Integer.valueOf(firstVersions[i]).compareTo(Integer.valueOf(secondVersions[i])); 40 | return Integer.signum(diff); 41 | } else { 42 | return Integer.signum(firstVersions.length - secondVersions.length); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/io/qameta/allure/maven/TestHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2024 Qameta Software Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.qameta.allure.maven; 17 | 18 | import org.apache.commons.io.filefilter.WildcardFileFilter; 19 | 20 | import java.nio.file.Path; 21 | import java.util.Arrays; 22 | import java.util.List; 23 | 24 | import static org.hamcrest.MatcherAssert.assertThat; 25 | import static org.hamcrest.Matchers.hasSize; 26 | import static org.hamcrest.Matchers.not; 27 | import static ru.yandex.qatools.matchers.nio.PathMatchers.exists; 28 | import static ru.yandex.qatools.matchers.nio.PathMatchers.isDirectory; 29 | 30 | /** 31 | * @author Dmitry Baev dmitry.baev@qameta.io Date: 05.08.15 32 | */ 33 | @SuppressWarnings("unused") 34 | public final class TestHelper { 35 | 36 | public static final List FILE_NAMES = Arrays.asList("behaviors.json", "categories.json", 37 | "packages.json", "timeline.json", "suites.json"); 38 | 39 | TestHelper() {} 40 | 41 | public static void checkReportDirectory(Path outputDirectory, int testCasesCount) { 42 | Path index = outputDirectory.resolve("index.html"); 43 | assertThat(index, exists()); 44 | 45 | Path dataDirectory = outputDirectory.resolve("data"); 46 | 47 | assertThat(dataDirectory, isDirectory()); 48 | 49 | for (String fileName : FILE_NAMES) { 50 | assertThat(dataDirectory.resolve(fileName), exists()); 51 | } 52 | 53 | assertThat("There is not enough test case files in " + dataDirectory + " directory.", 54 | getTestCases(dataDirectory.resolve("test-cases")), hasSize(testCasesCount)); 55 | } 56 | 57 | public static void checkSingleFile(Path outputDirectory) { 58 | Path index = outputDirectory.resolve("index.html"); 59 | assertThat(index, exists()); 60 | 61 | Path dataDirectory = outputDirectory.resolve("data"); 62 | assertThat(dataDirectory, not(exists())); 63 | 64 | for (String fileName : FILE_NAMES) { 65 | assertThat(dataDirectory.resolve(fileName), not(exists())); 66 | } 67 | } 68 | 69 | public static List getTestCases(Path dataDirectory) { 70 | return Arrays.asList(dataDirectory.toFile().list(new WildcardFileFilter("*.json"))); 71 | } 72 | } 73 | --------------------------------------------------------------------------------