【问题标题】:Jenkins is unable to locate file that can be located manuallyJenkins 无法找到可以手动定位的文件
【发布时间】:2021-06-23 18:21:46
【问题描述】:

当我将在命令提示符下手动使用的命令添加到 Jenkins 以运行我的项目时,Jenkins 无法找到引用的文件。

[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.631 s <<< FAILURE! - in TestSuite
[ERROR] main(test.java.IterateToEAMethods)  Time elapsed: 0.016 s  <<< FAILURE!
java.io.FileNotFoundException: Q:\A_Parts routing\03_Systeme\Selenium\Vega Automatisierung Teil 1\AutomatisierterSteuerungsantrag.xls (The system cannot find the path specified)
    at test.java.IterateToEAMethods.main(IterateToEAMethods.java:162)

当我使用完全相同的命令通过命令行运行这个项目时,它运行良好。

CD C:\Users\D171_o_QECJACK031\eclipse-workspace\VegaAutomatisierungPart2
mvn --settings settings.xml compile clean test

有谁知道如何让 Jenkins 访问该文件?

我使用文件的其他项目都没有这个问题,它们通过 Jenkins 运行。

【问题讨论】:

  • 只是为了确定:文件和 Jenkins 在同一台机器上?
  • 是的,他们在同一台机器上

标签: java selenium jenkins


【解决方案1】:

在 windows 中访问路径时,需要将 \ 替换为 \\。 您可以将dir 与您的脚本所在的路径一起使用:

// dir("<Your path where scripts are present>")
dir ("C:\\Users\\D171_o_QECJACK031\\eclipse-workspace\\VegaAutomatisierungPart2"){
     <Your commands>
 }

【讨论】:

  • @AlChristopher 你把dir 块放进去并执行了吗?
  • 是不是应该在Jenkins里面加windows批处理命令的地方?
  • 我尝试将它放在 Jenkins 中,但它仍然给出了关于无法找到文件的相同错误消息。
  • @AlChristopher 似乎无法找到此路径Q:\A_Parts routing\03_Systeme\Selenium\Vega Automatisierung Teil 1\AutomatisierterSteuerungsantrag.xls。你能放\` here instaead of `,你也可以删除文件夹Vega Automatisierung Teil 之间的空格,检查这个文件是否存在
猜你喜欢
  • 1970-01-01
  • 2015-10-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-21
  • 2017-01-28
相关资源
最近更新 更多