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

时间:2018-04-30 12:52:57

标签: java maven selenium jenkins jenkins-plugins

我正在使用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

从日食中运行MVN清理请参阅结果: 由于我对共享虚拟机的权限,无法在命令行执行此操作。

[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 个答案:

答案 0 :(得分:0)

向CLI命令添加clean。 如果你执行mvn test那么它应该是mvn clean test。

问题可能是由您在项目名称中找到的空间引起的,我建议修剪项目名称中的空格。

答案 1 :(得分:0)

任何人都可以参考。

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

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

感谢您的反馈。

相关问题