带有 SureFire 插件的 Maven TestNG:无法找到请求目标的有效证书路径

Maven TestNG with SureFire plugin: unable to find valid certification path to requested target

我正在尝试使用 TestNG Maven 和 SureFire 插件调整我的测试,但出现以下错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project Demo: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\ihorh\Workspace\Demo\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] There was an error in the forked process
[ERROR] sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:665)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:279)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:243)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1077)

......

如果我 运行 没有 maven(只有 test.ng 文件),一切都会成功。或者,如果我从 pom.xml 中删除以下块:

<build>
          <plugins>
           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
              <suiteXmlFiles>
                <suiteXmlFile>testng.xml</suiteXmlFile>
              </suiteXmlFiles>
            </configuration>
          </plugin>
          </plugins>
      </build>

我遇到了完全相同的问题,但我在尝试 运行 testng.xml 文件时也遇到了问题。 我删除了以下行: https://testng.org/testng-1.0.dtd”>

这似乎解决了问题。