actions / setup-java

Set up your GitHub Actions workflow with a specific version of Java
MIT License
1.47k stars 708 forks source link

mvn command not found on k8s self hosted actions-runners #594

Closed haimari closed 3 months ago

haimari commented 4 months ago

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

HarithaVattikuti commented 4 months ago

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

aparnajyothi-y commented 4 months ago

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:

aparnajyothi-y commented 4 months ago

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

akakshuki commented 4 months ago

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?

aparnajyothi-y commented 3 months ago

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
aparnajyothi-y commented 3 months ago

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

aparnajyothi-y commented 3 months ago

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.