maven - 在另一个目录中为“uses”运行 github 操作
问题描述
我的 Maven 存储库在./java
目录中。我想在./java
目录中运行 Maven 测试,但出现以下错误:
The goal you specified requires a project to execute but there is no POM in this directory (/github/workspace). Please verify you invoked Maven from the correct directory. -> [Help 1]
这是我的工作流程:
# This is a basic workflow to help you get started with Actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
defaults:
run:
working-directory: java
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run maven test
uses: xlui/action-maven-cli@master
with:
lifecycle: 'clean package test'
好像working-directory
没用,怎么解决?
解决方案
working-directory
只能应用于run:
步骤(例如,它不适用于动作)
该操作xlui/action-maven-cli@master
当前不允许通知 apath
执行 maven 命令。
你也可以
使用Github Marketplace 上可用的另一个(类似)操作,它允许
directory path
在执行 maven 命令之前通知 a,打开 PR 以更新
xlui/action-maven-cli
操作,添加输入path
(或env
变量)以cd
在执行 maven 命令之前执行命令,在一个步骤中直接安装
maven
在您的工作流程上(例如setup maven action),然后在另一个步骤(不使用该操作)上直接运行 maven 命令之前使用run: |
beforecd ./java
executionsh -c "mvn clean package test"
,
像这样的东西(对于第三个选项):
steps:
- uses: actions/checkout@v2
- name: Install maven
run: |
...
- name: Run maven command
run: |
cd ./java
mvn clean package test
推荐阅读
- perl - 如何在不干扰格式的情况下对数字进行排序
- python - 使用二进制信息有效地保存 4D 数组
- reactjs - 如何在 Next.js 中执行客户端数据获取
- mysql - Mysql INNER JOIN 在 LEFT OUTER JOIN 之后
- android - 在 Flutter 和 iOS 中使用可变主机进行深度链接
- sql - 如何将此使用连接语句的查询转换为使用子查询的查询?
- java - 在 Spring Boot 中检索 bean?
- python - 为什么 1//0.01 == 99 在 Python 中?
- c# - Azure DevOps Api 错误:RuleValidationException:字段“状态”包含不在支持值列表中的值“活动”C#
- python - jupyter notebooks 加载 nbextensions 的问题