Browsermob 依赖项插入无法与 allure testng 一起使用
Browsermob dependecy insertion cannot work with allure testng
我正在尝试使用 browsermob 更改请求 headers,但我什至无法插入依赖项。我不知道 allure 和 browsermob 之间是否存在任何不兼容问题,我已经尝试降级 allure 版本,但我真的不知道发生了什么。
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
<scope>test</scope>
</dependency>
只需插入此依赖项和 运行 我的基本测试就收到以下错误消息:
[ERROR] org.testng.ITestNGListener: Provider
io.qameta.allure.testng.AllureTestNg could not be instantiated [INFO]
[INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0,
Skipped: 0 [INFO] [ERROR] There are test failures.
Please refer to /mypath/my-project/target/surefire-reports for the
individual test results. Please refer to dump files (if any exist)
[date].dump, [date]-jvmRun[N].dump and [date].dumpstream. There was an
error in the forked processorg.testng.ITestNGListener: Provider
io.qameta.allure.testng.AllureTestNg could not be instantiated
org.apache.maven.surefire.booter.SurefireBooterForkException: There
was an error in the forked processorg.testng.ITestNGListener: Provider
io.qameta.allure.testng.AllureTestNg could not be instantiated at
org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:675)
at
org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:285)
at
org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:248)
at
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1217)
at
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1063)
at
org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:889)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at
org.apache.maven.cli.MavenCli.execute(MavenCli.java:956) at
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:192) at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566) at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
这是我的 pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>my-project</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argLine>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<version>3.0.0-M4</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<artifactId>selenium-java</artifactId>
<groupId>org.seleniumhq.selenium</groupId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<scope>compile</scope>
<version>4.13-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<artifactId>maven-surefire-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.0-M4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<artifactId>testng</artifactId>
<groupId>org.testng</groupId>
<scope>compile</scope>
<version>7.1.0</version>
</dependency>
<!-- https://github.com/allure-framework/allure2/releases/tag/2.13.2 -->
<dependency>
<artifactId>allure-testng</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>test</scope>
<version>2.13.2</version>
</dependency>
<dependency>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
<version>2.8.2</version>
</dependency>
<dependency>
<artifactId>allure-java-commons</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>compile</scope>
<version>2.13.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<scope>test</scope>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->
<dependency>
<artifactId>jansi</artifactId>
<groupId>org.fusesource.jansi</groupId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lightbody.bmp/browsermob-proxy -->
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<groupId>org.example</groupId>
<modelVersion>4.0.0</modelVersion>
<properties>
<aspectj.version>1.9.5</aspectj.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<artifactId>allure-maven</artifactId>
<configuration>
<reportVersion>2.10.0</reportVersion>
</configuration>
<groupId>io.qameta.allure</groupId>
<version>2.10.0</version>
</plugin>
</plugins>
</reporting>
<version>1.0-SNAPSHOT</version>
</project>
您找到问题的答案了吗?
我只是遇到了同样的问题,经过数小时的研究,我通过重新排序 pom.xml 文件中的依赖项来修复它:你对 allure 的依赖项必须低于你对文件中 browserMobProxy 的依赖项......出于我可以的原因'解释一下。
所以我认为这对你有用:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>my-project</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argLine>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<version>3.0.0-M4</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<artifactId>selenium-java</artifactId>
<groupId>org.seleniumhq.selenium</groupId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<scope>compile</scope>
<version>4.13-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<artifactId>maven-surefire-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.0-M4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<artifactId>testng</artifactId>
<groupId>org.testng</groupId>
<scope>compile</scope>
<version>7.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lightbody.bmp/browsermob-proxy -->
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
<scope>test</scope>
</dependency>
<!-- https://github.com/allure-framework/allure2/releases/tag/2.13.2 -->
<dependency>
<artifactId>allure-testng</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>test</scope>
<version>2.13.2</version>
</dependency>
<dependency>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
<version>2.8.2</version>
</dependency>
<dependency>
<artifactId>allure-java-commons</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>compile</scope>
<version>2.13.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<scope>test</scope>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->
<dependency>
<artifactId>jansi</artifactId>
<groupId>org.fusesource.jansi</groupId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<groupId>org.example</groupId>
<modelVersion>4.0.0</modelVersion>
<properties>
<aspectj.version>1.9.5</aspectj.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<artifactId>allure-maven</artifactId>
<configuration>
<reportVersion>2.10.0</reportVersion>
</configuration>
<groupId>io.qameta.allure</groupId>
<version>2.10.0</version>
</plugin>
</plugins>
</reporting>
<version>1.0-SNAPSHOT</version>
</project>
我正在尝试使用 browsermob 更改请求 headers,但我什至无法插入依赖项。我不知道 allure 和 browsermob 之间是否存在任何不兼容问题,我已经尝试降级 allure 版本,但我真的不知道发生了什么。
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
<scope>test</scope>
</dependency>
只需插入此依赖项和 运行 我的基本测试就收到以下错误消息:
[ERROR] org.testng.ITestNGListener: Provider io.qameta.allure.testng.AllureTestNg could not be instantiated [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [ERROR] There are test failures.
Please refer to /mypath/my-project/target/surefire-reports for the individual test results. Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. There was an error in the forked processorg.testng.ITestNGListener: Provider io.qameta.allure.testng.AllureTestNg could not be instantiated org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked processorg.testng.ITestNGListener: Provider io.qameta.allure.testng.AllureTestNg could not be instantiated at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:675) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:285) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:248) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1217) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1063) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:889) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:192) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
这是我的 pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>my-project</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argLine>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<version>3.0.0-M4</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<artifactId>selenium-java</artifactId>
<groupId>org.seleniumhq.selenium</groupId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<scope>compile</scope>
<version>4.13-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<artifactId>maven-surefire-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.0-M4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<artifactId>testng</artifactId>
<groupId>org.testng</groupId>
<scope>compile</scope>
<version>7.1.0</version>
</dependency>
<!-- https://github.com/allure-framework/allure2/releases/tag/2.13.2 -->
<dependency>
<artifactId>allure-testng</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>test</scope>
<version>2.13.2</version>
</dependency>
<dependency>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
<version>2.8.2</version>
</dependency>
<dependency>
<artifactId>allure-java-commons</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>compile</scope>
<version>2.13.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<scope>test</scope>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->
<dependency>
<artifactId>jansi</artifactId>
<groupId>org.fusesource.jansi</groupId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lightbody.bmp/browsermob-proxy -->
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<groupId>org.example</groupId>
<modelVersion>4.0.0</modelVersion>
<properties>
<aspectj.version>1.9.5</aspectj.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<artifactId>allure-maven</artifactId>
<configuration>
<reportVersion>2.10.0</reportVersion>
</configuration>
<groupId>io.qameta.allure</groupId>
<version>2.10.0</version>
</plugin>
</plugins>
</reporting>
<version>1.0-SNAPSHOT</version>
</project>
您找到问题的答案了吗? 我只是遇到了同样的问题,经过数小时的研究,我通过重新排序 pom.xml 文件中的依赖项来修复它:你对 allure 的依赖项必须低于你对文件中 browserMobProxy 的依赖项......出于我可以的原因'解释一下。
所以我认为这对你有用:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>my-project</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argLine>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<version>3.0.0-M4</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<artifactId>selenium-java</artifactId>
<groupId>org.seleniumhq.selenium</groupId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<scope>compile</scope>
<version>4.13-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<artifactId>maven-surefire-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.0-M4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<artifactId>testng</artifactId>
<groupId>org.testng</groupId>
<scope>compile</scope>
<version>7.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lightbody.bmp/browsermob-proxy -->
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
<scope>test</scope>
</dependency>
<!-- https://github.com/allure-framework/allure2/releases/tag/2.13.2 -->
<dependency>
<artifactId>allure-testng</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>test</scope>
<version>2.13.2</version>
</dependency>
<dependency>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
<version>2.8.2</version>
</dependency>
<dependency>
<artifactId>allure-java-commons</artifactId>
<groupId>io.qameta.allure</groupId>
<scope>compile</scope>
<version>2.13.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<scope>test</scope>
<version>2.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->
<dependency>
<artifactId>jansi</artifactId>
<groupId>org.fusesource.jansi</groupId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<groupId>org.example</groupId>
<modelVersion>4.0.0</modelVersion>
<properties>
<aspectj.version>1.9.5</aspectj.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<artifactId>allure-maven</artifactId>
<configuration>
<reportVersion>2.10.0</reportVersion>
</configuration>
<groupId>io.qameta.allure</groupId>
<version>2.10.0</version>
</plugin>
</plugins>
</reporting>
<version>1.0-SNAPSHOT</version>
</project>