Maven not existing for Github Actions? #25734
-
Hello. I am writing regarding an issue I am having on a self-hosted runner in Github Actions. I want to see if I am missing something, or am just being stupid - hopefully someone here knows what my issue is. Let’s get started. Everything was fine before I decided to update my Java project (using Maven) from java 8 to java 17. After which, a bunch of issues started. I eventually tracked down that the issue came from the fact that the Maven I got from the I used this page here as a guide/tutorial and got it working from shell, at least. That’s where the main issue comes in. Github Actions cannot seem to access the ‘mvn’ command (throws error regarding mvn cmd not being found). However, when I use either root or the user which runner is under manually from ssh, it does actually exist and work. I am using Ubuntu 18.04. Here is my And Github Actions error:
Finally, my workflow file. I don’t know how exactly the text formatting work here, so apologies if the spacing gets messed up.
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Hi @UnfamousThomas |
Beta Was this translation helpful? Give feedback.
-
Hey. Just tested it, this did indeed work… Though it is a bit strange that it did to me. When I run |
Beta Was this translation helpful? Give feedback.
-
Probably, you can also try to set PATH variable once in the workflow.
more info Workflow commands for GitHub Actions - GitHub Docs |
Beta Was this translation helpful? Give feedback.
-
@UnfamousThomas |
Beta Was this translation helpful? Give feedback.
-
Also could be this is better than support own setup of Maven - Setup Maven · Actions · GitHub Marketplace · GitHub |
Beta Was this translation helpful? Give feedback.
-
This should indeed work in theory, but for me at least, does not. As for the other options (PATH variable in workflow) - I have not really tested it, I originally opted to supply the mvn path via a secret instead. And then do Finally, the action (setup maven) option. Yeah, that works. Thanks… I didn’t really even consider that option. |
Beta Was this translation helpful? Give feedback.
-
I’d suggest not using a secret for non secret paths. GitHub will redact secrets in logs, and that will make it harder for you to read them. An action, another repository, … anything else would be better. |
Beta Was this translation helpful? Give feedback.
Hi @UnfamousThomas
according to your workflow, seems you run actions on self-hosted runners.
Could it be that mvn is not in the PATH of user from which run server (runner application)?
Could you try to add a full path , eg
/some_path/mvn
in your workflow instead of justmvn
?