jenkins 无法执行目标组织,apache,maven,插件:maven-surefire-插件:3.0.0-M4:测试(默认测试)

nzkunb0c  于 2022-11-02  发布在  Jenkins
关注(0)|答案(2)|浏览(262)

我在使用maven surefire插件3.0.0-M4和Maven版本3.6.3、3.6.0和3.3.9以及jdk1.8.0_222(Ubuntu 18.0.4)时遇到了这个问题。我的pom.xml如下:

  1. <project xmlns="http://maven.apache.org/POM/4.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>Expertus</groupId>
  6. <artifactId>Expertus</artifactId>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <name>ExpertusONE_4.5</name>
  9. <description>ExpertusONE_4.5</description>
  10. <dependencies>
  11. <dependency>
  12. <groupId>org.seleniumhq.selenium</groupId>
  13. <artifactId>selenium-java</artifactId>
  14. <version>3.141.59</version>
  15. </dependency>
  16. <dependency>
  17. <groupId>org.testng</groupId>
  18. <artifactId>testng</artifactId>
  19. <version>7.0.0</version>
  20. <scope>test</scope>
  21. </dependency>
  22. <dependency>
  23. <groupId>log4j</groupId>
  24. <artifactId>log4j</artifactId>
  25. <version>1.2.17</version>
  26. </dependency>
  27. <dependency>
  28. <groupId>org.apache.poi</groupId>
  29. <artifactId>poi</artifactId>
  30. <version>4.1.1</version>
  31. </dependency>
  32. <dependency>
  33. <groupId>org.apache.poi</groupId>
  34. <artifactId>poi-ooxml</artifactId>
  35. <version>4.1.1</version>
  36. </dependency>
  37. <dependency>
  38. <groupId>org.apache.maven.plugins</groupId>
  39. <artifactId>maven-failsafe-plugin</artifactId>
  40. <version>3.0.0-M4</version>
  41. <scope>test</scope>
  42. </dependency>
  43. </dependencies>
  44. <packaging>war</packaging>
  45. <build>
  46. <sourceDirectory>src</sourceDirectory>
  47. <resources>
  48. <resource>
  49. <directory>src</directory>
  50. </resource>
  51. </resources>
  52. <plugins>
  53. <plugin>
  54. <artifactId>maven-compiler-plugin</artifactId>
  55. <version>3.8.0</version>
  56. <configuration>
  57. <source>1.8</source>
  58. <target>1.8</target>
  59. </configuration>
  60. </plugin>
  61. <plugin>
  62. <groupId>org.apache.maven.plugins</groupId>
  63. <artifactId>maven-surefire-plugin</artifactId>
  64. <version>3.0.0-M4</version>
  65. <configuration>
  66. <useSystemClassLoader>false</useSystemClassLoader>
  67. <includes>
  68. <include>CreateOrganization.java</include>
  69. </includes>
  70. <suiteXmlFiles>
  71. <suiteXmlFile>/home/nivedab/Desktop/LocalCode/ExpertusONE_4.5/Learning_Suite.xml</suiteXmlFile>
  72. </suiteXmlFiles>
  73. </configuration>
  74. </plugin>
  75. </plugins>
  76. </build>
  77. <properties>
  78. <java.version>1.8.0_222</java.version>
  79. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  80. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  81. <maven.compiler.source>1.8</maven.compiler.source>
  82. <maven.compiler.target>1.8</maven.compiler.target>
  83. </properties>
  84. </project>

Jenkins输出如下:

  1. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test
  2. (default-test) on project Expertus: There are test failures.
uqjltbpv

uqjltbpv1#

@Nivi首先,规则是不要阅读所有的人写在谷歌上,因为他们也写了坏的页面。正确的事情是阅读原始教程从Apache Maven。
您能否正确阅读本文档,并查看https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html页上出现的所有单词**“suiteXmlFiles”,以确定您在POM中使用的这些配置参数不应组合。
接下来,您使用绝对路径完全破坏了Maven的所有功能。您的文件
Learning_Suite.xml应该是模块基本目录的相对路径。因此,它是一个资源文件,配置在文档中看起来像<file>src/test/resources/suite.xml</file>https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html
另外,版本
1.8.0_222**是任何人都不应该使用的。这对于每个POM来说都是足够和透明的:

  1. <maven.compiler.source>1.8</maven.compiler.source>
  2. <maven.compiler.target>1.8</maven.compiler.target>
wb1gzix0

wb1gzix02#

  1. <suiteXmlFile>src/test/resources/${suiteXmlFile}.xml</suiteXmlFile>

任何名称都将具有XML文件,测试将运行

相关问题