有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Jenkins Selenium Maven测试错误无法执行目标

我第一次使用Jenkins(2.107.2)运行maven测试。 平台:Linux

这是一个使用selenium的java程序,在以下问题上失败

我尝试在运行之前手动删除该目录,但没有效果

并设置任何人访问该文件夹的权限

有什么想法/建议说明它出错的原因吗

13:34:30 Started by user Test User
13:34:30 Building in workspace /home/test.user/eclipse-workspace/Carspares Automation
13:34:30 Xvfb starting$ Xvfb :1 -fbdir /var/lib/jenkins/xvfb-28-..fbdir7240341890394839754
13:34:35 [Carspares Automation] $ /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/bin/mvn -f "/home/test.user/eclipse-workspace/Carspares Automation/pom.xml" clean test
13:34:36 [INFO] Scanning for projects...
13:34:36 [INFO] 
13:34:36 [INFO] -------------------------< Automation:Jenkins >-------------------------
13:34:36 [INFO] Building Jenkins 0.0.1-SNAPSHOT
13:34:36 [INFO] --------------------------------[ jar ]---------------------------------
13:34:37 [INFO] 
13:34:37 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Jenkins ---
13:34:37 [INFO] Deleting /home/test.user/eclipse-workspace/Carspares Automation/target
13:34:38 [INFO] ------------------------------------------------------------------------
13:34:38 [INFO] BUILD FAILURE
13:34:38 [INFO] ------------------------------------------------------------------------
13:34:38 [INFO] Total time: 1.647 s
13:34:38 [INFO] Finished at: 2018-04-30T13:34:38+01:00
13:34:38 [INFO] ------------------------------------------------------------------------
13:34:38 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project Jenkins: Failed to clean project: Failed to delete /home/test.user/eclipse-workspace/Carspares Automation/target/classes/Jenkins_TestNG/GetScreenshot.class -> [Help 1]
13:34:38 [ERROR] 
13:34:38 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
13:34:38 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
13:34:38 [ERROR] 
13:34:38 [ERROR] For more information about the errors and possible solutions, please read the following articles:
13:34:38 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
13:34:38 Build step 'Invoke top-level Maven targets' marked build as failure
13:34:38 [htmlpublisher] Archiving HTML reports...
13:34:38 [htmlpublisher] Archiving at PROJECT level /home/test.user/eclipse-workspace/Carspares Automation/test-output to /var/lib/jenkins/jobs/Reserve Vehicle Maven/htmlreports/HTML_20Report
13:34:38 TestNG Reports Processing: START
13:34:38 Looking for TestNG results report in workspace using pattern: **/testng-results.xml
13:34:38 testng-results.xml was last modified before this build started. Ignoring it.
13:34:38 Saving reports...
13:34:38 Found matching files but did not find any TestNG results.
13:34:38 Xvfb stopping
13:34:38 Finished: FAILURE

已从eclipse ide运行MVN clean,请参见结果: 由于我对共享vm的权限,目前无法从命令行执行此操作

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Jenkins 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------

    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Jenkins ---
    [INFO] Deleting /home/test.user/eclipse-workspace/Carspares Automation/target
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.177 s
    [INFO] Finished at: 2018-04-30T14:35:50+01:00
    [INFO] Final Memory: 9M/304M
    [INFO] ------------------------------------------------------------------------

在jenkins中重新运行,然后出现稍微不同的错误

14:36:14 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project Jenkins: Failed to clean project: Failed to delete /home/test.user/eclipse-workspace/Carspares Automation/target/classes/META-INF/MANIFEST.MF -> [Help 1]
14:36:14 [ERROR] 
14:36:14 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:36:14 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:36:14 [ERROR] 

我现在可以从命令行运行clean。它成功地清洗了。 再次运行jenkins,出现以下错误

15:40:51 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Jenkins: Fatal error compiling: directory not found: /home/test.user/eclipse-workspace/Carspares Automation/target/classes -> [Help 1]

共 (2) 个答案

  1. # 1 楼答案

    将clean添加到CLI命令。 如果您执行mvn测试,那么它应该是mvn清洁测试

    这个问题可能是由项目名称中的空格引起的,我建议修剪项目名称中的空格

  2. # 2 楼答案

    供任何人参考

    我从未找到问题的原因,也无法解决它

    我在eclipse中删除了maven项目,创建了一个新项目。然后新的工作正常

    谢谢你的反馈