【问题标题】:Maven tests run locally but fail in github actionMaven 测试在本地运行但在 github 操作中失败
【发布时间】:2021-02-19 20:52:52
【问题描述】:

我正在尝试在我的仓库中运行 here 列出的基本 maven java 操作:https://github.com/dhowe/rita2/

mvn -B package --file pom.xml cmd 在我的本地存储库中正常运行,但在 github 操作中测试失败并出现以下错误(完整日志 here):

Exception: Cannot load dictionary at rita_dict.js /home/runner/work/rita2/rita2

很明显,通过 github 操作运行时找不到字典资源。但是为什么maven会在本地找到文件(src/main/java/rita_dict.js),但在action中运行时却找不到?

【问题讨论】:

  • 你有没有考虑将 src/main/java/rita_dict.js 移到 /src/main/resources 下?
  • 我确实考虑过,但我仍然想知道这里的问题是什么,以及 github 操作上的环境有什么不同

标签: maven github-actions


【解决方案1】:

按照 P3trur0 的建议切换到 /src/main/resources 中指定资源(不确定为什么在 maven 中指定为资源时它不起作用),之后构建按预期工作

【讨论】:

    猜你喜欢
    • 2020-12-15
    • 2022-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 2022-07-07
    • 2021-10-09
    相关资源
    最近更新 更多