简体   繁体   English

未能执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test

[英]Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test

I'm trying to learn Selemnium with JAVA.我正在尝试使用 JAVA 学习 Selemnium。 I've the error below when I use command "mvn test".使用命令“mvn test”时出现以下错误。 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test未能执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.tchateau.mavenTest</groupId>
  <artifactId>TestMaven</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>TestMaven</name>
  <url>http://maven.apache.org</url>

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

  <dependencies>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>3.0.5</version>
        <scope>test</scope>
    </dependency>

        <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>5.0.4</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.13.2</version>
        <scope>test</scope>
    </dependency>
  </dependencies>

</project>

C:\Users\tchateau\Documents\workspace\mavenWorkspace\TestMaven
λ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.tchateau.mavenTest:TestMaven >------------------
[INFO] Building TestMaven 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TestMaven ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\tchateau\Documents\workspace\mavenWorkspace\TestMaven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ TestMaven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\tchateau\Documents\workspace\mavenWorkspace\TestMaven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ TestMaven ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\tchateau\Documents\workspace\mavenWorkspace\TestMaven\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ TestMaven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to C:\Users\tchateau\Documents\workspace\mavenWorkspace\TestMaven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ TestMaven ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.386 s
[INFO] Finished at: 2019-10-29T09:54:36+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project TestMaven: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\tchateau\Documents\workspace\mavenWorkspace\TestMaven\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].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:657)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1161)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1002)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:848)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I've tried command: mvn dependency::tree and I've refreshed my project eclipse.我已经尝试过命令:mvn dependency::tree 并且我已经刷新了我的项目 eclipse。 I've tried to change version's surefire but no result.我试图改变版本的万无一失,但没有结果。

Have you some ideas?你有什么想法吗? Stackoverflow's topics which already exist don't help me more. Stackoverflow 已经存在的主题对我没有更多帮助。

Did you try force updating the snapshots?您是否尝试强制更新快照? Running below command will re-download all the dependencies, also will ignore the test failures hope this one helps.运行下面的命令将重新下载所有依赖项,也将忽略测试失败希望这有帮助。

mvn clean install -U -Dmaven.test.failure.ignore=true

It was my testng.xml这是我的testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test thread-count="5" name="Test">
    <classes>
      <class name="org.tchateau.mavenTest.RESTAPITest"/>
      <class name="org.tchateau.mavenTest.SeleniumTest"/>
      <class name="org.tchateau.mavenTest.AppiumTest"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

When you use eclipse to generate testng.xml with right-click > TestNG > Convert to TestNG When you use eclipse to generate testng.xml with right-click > TestNG > Convert to TestNG

Eclipse write: <:DOCTYPE suite SYSTEM "https.//testng.org/testng-1.0.dtd"> Eclipse 写: <:DOCTYPE suite SYSTEM "https.//testng.org/testng-1.0.dtd">

And it was: <:DOCTYPE suite SYSTEM "http.//testng.org/testng-1.0.dtd">它是: <:DOCTYPE suite SYSTEM "http.//testng.org/testng-1.0.dtd">

(https -> http) (https -> http)

If you are using testNg dependencies and if you have created testng.xml or any suite file from below option-如果您使用的是 testNg 依赖项,并且您已创建 testng.xml 或以下选项中的任何套件文件 -

anytestNg test class -> Right Click -> select TestNg -> Convert to TestNG anytestNg 测试class ->右键单击 -> select TestNg ->转换为 Z0F10ECB77AE6532AE8CA448D8
then然后
open testng.xml and if you could see- HTTP instead of HTTPS in打开testng.xml如果你能看到 - HTTP 而不是 Z0E8433F9A40026F3BA601C1C1

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

make changes from HTTP -> HTTPSHTTP -> HTTPS进行更改

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">

Add below to your Surefire plugin configuration在您的 Surefire 插件配置中添加以下内容

<configuration>
    <testFailureIgnore>true</testFailureIgnore>
</configuration>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) 未能在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project 从命令行运行 Maven 时“无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)” - " Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)" while running Maven from command line 无法在项目测试中执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test):未执行任何测试 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project testing: No tests were executed 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.16:SAKAI中的测试错误 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test error in SAKAI 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test on project XYZ - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test on project XYZ 无法在项目myserver上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(默认测试) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project myserver 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) 无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM