Maven构建Selenium测试时Allure报告无法生成求助
It looks like your Allure report generation is failing mid-process based on the truncated log you shared. Let’s walk through the most common fixes for this issue:
1. Verify Allure Plugin Configuration in pom.xml
Outdated or missing configuration in your pom.xml is a frequent culprit. Make sure you have the correct Allure dependencies and plugin setup. Here’s a working example for a Selenium project:
<!-- Allure TestNG Dependency --> <dependency> <groupId>io.qameta.allure</groupId> <artifactId>allure-testng</artifactId> <version>2.24.0</version> <!-- Use the latest stable version --> <scope>test</scope> </dependency> <!-- Allure Maven Plugin & Surefire Setup --> <build> <plugins> <plugin> <groupId>io.qameta.allure</groupId> <artifactId>allure-maven</artifactId> <version>2.12.0</version> <!-- Match with compatible Allure report version --> <configuration> <reportVersion>2.24.0</reportVersion> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.1.2</version> <configuration> <testFailureIgnore>false</testFailureIgnore> <argLine> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" </argLine> </configuration> <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.20.1</version> </dependency> </dependencies> </plugin> </plugins> </build>
Note: Ensure the Allure plugin version is compatible with the report version you’re using—mismatches often cause failures.
2. Update Allure Version and Reinstall
Your log shows it’s trying to use Allure 2.3.1, which is quite outdated. Newer versions fix many bugs. Update the report version in your plugin config, then force a clean installation:
mvn clean allure:install
This will download the specified Allure version and set it up correctly in your project’s .allure directory.
3. Confirm Test Results Are Generated
Allure needs test result files (usually in target/allure-results) to build the report. First, run your tests separately to confirm they execute without errors:
mvn clean -Dtest=TestLogs test
Check if the target/allure-results folder exists and is populated with JSON files. If not, your tests might be missing Allure annotations (like @Test, @Step) or integration setup.
4. Fix Corrupted Allure Installation
If the .allure directory has corrupted files or permission issues, delete it and reinstall:
- Delete the folder at
C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium/.allure - Run
mvn allure:installto fetch a fresh copy - Try generating the report again:
mvn clean -Dtest=TestLogs test allure:report
5. Get the Full Error Log
Your provided log is truncated. To see the exact issue (like missing files or version conflicts), run the command with debug mode enabled:
mvn clean -Dtest=TestLogs test allure:report -X
This will show the full stack trace, which can pinpoint the root cause.
If none of these steps work, share the full debug log, and we can dig deeper!
内容的提问来源于stack exchange,提问作者Zoette

