act: Maven Step Fails

Expected behavior:

  • Maven commands (mvn) execute when using act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04-full

Actual behavior:

  • Maven builds fail due to Maven not being installed.
| /github/workflow/3: line 2: mvn: command not found
[Build, Test, and Upload/Java Application Container]   ❌  Failure - Compile and Test Using Maven

The environments image appears to be either out-of-date, or does not install the same tools/dependencies as the GitHub virtual-environments. This means that currently, Java builds that can be executed directly from GitHub Actions cannot be ran locally.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 29 (9 by maintainers)

Most upvoted comments

Same issue. A resolution would be very helpful

I got the same error, how can i fix this ?

name: Java CI with Maven
on:
  push:
    branches: [ '*' ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Build with Maven
      run: mvn --settings .settings.xml -B package

#act -v
...
[Java CI with Maven/build] ⭐  Run Build with Maven
DEBU[0093] Wrote command '/usr/bin/mvn --settings .settings.xml -B package' to 'workflow/2'
DEBU[0093] Writing entry to tarball workflow/2 len:104
[Java CI with Maven/build] Extracting content to '/github/'
[Java CI with Maven/build] Exec command '[bash --noprofile --norc -eo pipefail /github/workflow/2]'
| /github/workflow/2: line 2: /usr/bin/mvn: No such file or directory
[Java CI with Maven/build]   ❌  Failure - Build with Maven
DEBU[0094] exit with `FAILURE`: 127
Error: exit with `FAILURE`: 127

FWIW I created an image which adds Maven https://quay.io/repository/jamezp/act-maven.

@vroyer @aaron-goulet-bfg Temporary workaround until fix is released.

    - name: Download Maven
      run: |
        curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip -o maven.zip
        apt-get update
        apt-get -y install unzip
        unzip -d /usr/share maven.zip
        rm maven.zip
        ln -s /usr/share/apache-maven-3.6.3/bin/mvn /usr/bin/mvn
        echo "M2_HOME=/usr/share/apache-maven-3.6.3" | tee -a /etc/environment

FWIW I created an image which adds Maven https://quay.io/repository/jamezp/act-maven.

Omg, you are a god amongst men!

For anyone who is unsure on how to run the image - it took me a while to figure it out - then you have to run it like this: act -P ubuntu-latest=quay.io/jamezp/act-maven

when can we expect a fix for this?

@aaron-goulet-bfg can you share a sample workflow file?

That’s because mvn is not installed in that image

Ok, is there an “official” act image that includesmvn or shall I just install it prior to running anything on it?

That’s because mvn is not installed in that image

act -j build_linux_arm64 -P ghcr.io/catthehacker/ubuntu:runner-18.04 --container-architecture linux/amd64

proper command would be act -j build_linux_arm64 -P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:runner-18.04 --container-architecture linux/amd64

but from what I see, workflow is using ubuntu-latest so it should be -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:runner-18.04

Another decent workaround @jeff-miller-cfa ; use the full docker image

act -j build -P ubuntu-latest=nektos/act-environments-ubuntu:18.04

this doesn’t work for me, I chose Large image at install and my ~/.actrc contains:

-P ubuntu-latest=nektos/act-environments-ubuntu:18.04
-P ubuntu-18.04=nektos/act-environments-ubuntu:18.04

but still I have the same issue when running

same problem here

Another decent workaround @jeff-miller-cfa ; use the full docker image

act -j build -P ubuntu-latest=nektos/act-environments-ubuntu:18.04