【发布时间】:2016-02-20 04:27:44
【问题描述】:
我正在尝试将 Selenium TestNG 集成到 maven,但在将依赖项添加到 pom.xml 时遇到了麻烦(如article 中所述),并且出现错误。仅当我添加 selenium 和 testng 依赖项时才会出现问题,我已经将这些库导入到项目中。下面是xml代码
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>ProV1</groupId>
<artifactId>ProV1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
这是我得到的错误 正如一些文章中所建议的,我清理了项目,刷新了但没有任何结果。 我是 Maven 的新手,因此对于如何解决此问题的所有有用建议将非常感激。
【问题讨论】:
-
我会尝试用maven强制更新或手动下载jar
-
从你的项目中移除 testNG 和 selenium 的 jars。 Maven 依赖项将负责在类路径中添加 jar。其次,去
user\.m2 repository。使用*.lastUpdated搜索。从结果中删除 testNG 和 selenium jar,现在手动下载 jar,将它们放在相同的 .m2 位置。现在运行mvn test。它不应该给出工件传输错误。
标签: eclipse maven selenium testng pom.xml