actions / setup-java

Set up your GitHub Actions workflow with a specific version of Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mvn command not found on k8s self hosted actions-runners

haimari opened this issue · comments

What is the path for mvn command when running on self hosted runners in k8s

Hello @haimari
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

Hello @haimari, Thank you once again for creating this issue.
To find the exact path of the mvn command when running on self-hosted runners in a Kubernetes (k8s) environment, you would need to check within the specific runner's environment. This is because the path can vary based on how the runner environment is configured.

However, commonly, the mvn executable is located in the bin directory of the Maven installation. If Maven is installed at a standard location, you might find it at /usr/share/maven/bin/mvn or /usr/local/apache-maven/bin/mvn.

You can also use the which mvn command in your workflow to find out the path of the mvn command. This will output the full path of the mvn command if it's in the system's PATH.

Here's an example of how you could include it in your GitHub Actions workflow:

steps:

  • name: Find mvn path
    run: which mvn
    The output of this step will be the full path to your mvn command.

Hello @haimari, Please confirm if the above clarification helped you to proceed to close the issue.

Hi guys, I also met this issue and tried to find it out. It looks like... it has not been installed yet. I also use self host agent

Hello @haimari, Thank you once again for creating this issue. To find the exact path of the mvn command when running on self-hosted runners in a Kubernetes (k8s) environment, you would need to check within the specific runner's environment. This is because the path can vary based on how the runner environment is configured.

However, commonly, the mvn executable is located in the bin directory of the Maven installation. If Maven is installed at a standard location, you might find it at /usr/share/maven/bin/mvn or /usr/local/apache-maven/bin/mvn.

You can also use the which mvn command in your workflow to find out the path of the mvn command. This will output the full path of the mvn command if it's in the system's PATH.

Here's an example of how you could include it in your GitHub Actions workflow:

steps:

  • name: Find mvn path
    run: which mvn
    The output of this step will be the full path to your mvn command.
Run actions/setup-java@v4
Installed distributions
  Trying to resolve the latest version from remote
  Resolved latest version as 17.0.10+7
  Trying to download...
  Downloading Java 17.0.10+7 (Zulu) from https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-crac-jdk17.0.10-linux_x64.tar.gz ...
  Extracting Java archive...
  /usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /[project address]
  Setting Java 17.0.10+7 as the default
  Creating toolchains.xml for JDK version 17 from zulu
  Writing to /home/runner/.m2/toolchains.xml
  
  Java configuration:
    Distribution: zulu
    Version: 17.0.10+7
    Path: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.10-7/x64
  
Creating settings.xml with server-id: github
Writing to /home/runner/.m2/settings.xml

Is it installing the maven in this step?

Hello @akakshuki, actions/setup-java GitHub Action is designed to install JDK (Java Development Kit) not Maven. It sets up your GitHub Actions workflow with a specific version of Java. If you want to install Maven, you would typically use a separate step in your GitHub Actions workflow like below.
Hello @haimari, Please confirm if the above clarification to your question helped you to proceed to close the issue.

image

Hello @haimari, Please confirm if the above clarification to your question helped you to proceed to close the issue.

Hello @haimari , Proceeding to close this issue after two reminders as we didn't hear anything from you.
Feel free to reach us to reopen this for further assistance. Thank you.