簡體   English   中英

詹金斯+ Maven + TestNG = MojoFailureException

[英]Jenkins + Maven + TestNG = MojoFailureException

當我在Eclipse運行時, MavenTestNG可以正常運行並通過,但是當我在Jenkins運行時,會出現以下失敗消息:

MojoFailureException與許多其他錯誤不同,此異常不是由Maven核心本身生成的,而是由插件生成的。 根據經驗,插件會使用此錯誤來表示構建失敗,因為項目的依賴項或源存在問題,例如編譯或測試失敗。 異常的具體含義取決於插件,因此請查看其文檔。 許多常見的Maven插件的文檔可以通過我們的插件索引來獲得。

這是我的pom.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>com.techbeamers</groupId> <artifactId>loadtesting</artifactId> <version>0.0.1-SNAPSHOT</version> <name>Load Testing</name> <description>Selenium Load Testing Example using TestNG and Maven</description> <properties> <selenium.version>2.53.1</selenium.version> <testng.version>6.9.10</testng.version> </properties> <build> <plugins> <!-- Below plug-in is used to execute tests --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <suiteXmlFiles> <!-- TestNG suite XML files --> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> </build> <!-- Include the following dependencies --> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>${selenium.version}</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <type>maven-plugin</type> </dependency> </dependencies> </project> 

請幫忙-我不知道plugindependencies有什么問題。

我看到的第一個可能的問題是:定義屬性: testng.version ,將值設置為: 6.9.10 ,但是稍后在pom.xml忽略testng.version屬性,並將TestNG<version>設置為: 6.8

嘗試從當前的內容更改TestNG <dependency>的定義:

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.8</version>
    <scope>test</scope>
</dependency>

這樣定義定義如下:

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>${testng.version}</version>
    <scope>test</scope>
</dependency>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM