无法执行目标 org.apache.maven.plugins:maven-

我正在尝试用JAVA学习Selemnium。当我使用命令“mvn 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>

我尝试过命令: mvn dependency::tree 并且刷新了我的项目 eclipse。我尝试过更改版本的肯定但没有结果。

你有什么想法吗?Stackoverflow 上已经存在的主题对我没有更多帮助。


侃侃无极
浏览 138回答 4
4回答

慕的地8271018

这是我的testng.xml<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"><suite name="Suite">&nbsp; <test thread-count="5" name="Test">&nbsp; &nbsp; <classes>&nbsp; &nbsp; &nbsp; <class name="org.tchateau.mavenTest.RESTAPITest"/>&nbsp; &nbsp; &nbsp; <class name="org.tchateau.mavenTest.SeleniumTest"/>&nbsp; &nbsp; &nbsp; <class name="org.tchateau.mavenTest.AppiumTest"/>&nbsp; &nbsp; </classes>&nbsp; </test> <!-- Test --></suite> <!-- Suite -->使用eclipse生成testng.xml时右键> TestNG > Convert to TestNGEclipse 写:<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">它是:<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">(https -> http)

12345678_0001

您是否尝试过强制更新快照?运行下面的命令将重新下载所有依赖项,也会忽略测试失败希望这会有所帮助。mvn&nbsp;clean&nbsp;install&nbsp;-U&nbsp;-Dmaven.test.failure.ignore=true

德玛西亚99

将以下内容添加到您的 Surefire 插件配置中<configuration>&nbsp; &nbsp; <testFailureIgnore>true</testFailureIgnore></configuration>

catspeake

如果您正在使用 testNg 依赖项,并且您已从以下选项创建了 testng.xml 或任何套件文件 -anytestNg 测试类 ->右键单击 -> 选择TestNg&nbsp;->转换为 TestNG然后打开testng.xml,如果您可以看到 - HTTP 而不是 HTTPS<!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"http://testng.org/testng-1.0.dtd">从HTTP -> HTTPS进行更改<!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"https://testng.org/testng-1.0.dtd">
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java