Maven, issue with non-zero code: 127, maven command not recognised, configuration file present

These are my first days on netlify, so greetings to everyone.
I am trying to deploy an application dreamy-mestorf-97b584 written in Java+Spring built by maven, however I get the:

3:49:35 PM: Error running command: Build script returned non-zero exit code: 127

It seem to be a popular issue, but the search results didn’t match my case. I found in [Common Issue]: Frequently encountered problems during builds
that:

This means that the software required for that command you’ve set our build to use hasn’t been installed in our build environment.

BUT the configuration file as it is suggested above is present in my project.

How can I complete this process? Thanks!

The command “mvnw clean install” executed by IDE console works as it should and does complete with:

[INFO] BUILD SUCCESS

My netlify.toml:

[build]
base = “”
publish = “dist/car-rental”
command = “mvnw clean install”

My build settings:

DEPLOY LOG:
3:49:18 PM: Build ready to start
3:49:20 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
3:49:20 PM: build-image tag: v3.3.7
3:49:20 PM: buildbot version: d305548225ac57bb00eb5a596b0b8674e76a4681
3:49:20 PM: Fetching cached dependencies
3:49:20 PM: Failed to fetch cache, continuing with build
3:49:20 PM: Starting to prepare the repo for build
3:49:21 PM: No cached dependencies found. Cloning fresh repo
3:49:21 PM: git clone git@gitlab.com:MaxKryk/car-rental
3:49:24 PM: Preparing Git Reference refs/heads/master
3:49:25 PM: Found Netlify configuration file netlify.toml in site root
3:49:25 PM: Found Netlify configuration file(s). Overriding site configuration
3:49:25 PM: Starting build script
3:49:25 PM: Installing dependencies
3:49:26 PM: Downloading and installing node v10.20.1…
3:49:26 PM: Downloading https://nodejs.org/dist/v10.20.1/node-v10.20.1-linux-x64.tar.xz
3:49:26 PM:
###########################
3:49:26 PM: 38.8%
3:49:27 PM:
############################
3:49:27 PM: ############################################ 100.0%
3:49:27 PM: Computing checksum with sha256sum
3:49:27 PM: Checksums matched!
3:49:29 PM: Now using node v10.20.1 (npm v6.14.4)
3:49:29 PM: Attempting ruby version 2.6.2, read from environment
3:49:31 PM: Using ruby version 2.6.2
3:49:31 PM: Using PHP version 5.6
3:49:31 PM: Started restoring cached go cache
3:49:31 PM: Finished restoring cached go cache
3:49:31 PM: unset GOOS;
3:49:31 PM: unset GOARCH;
3:49:31 PM: export GOROOT=’/opt/buildhome/.gimme/versions/go1.12.linux.amd64’;
3:49:31 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
3:49:31 PM: go version >&2;
3:49:31 PM: export GIMME_ENV=’/opt/buildhome/.gimme/env/go1.12.linux.amd64.env’;
3:49:31 PM: go version go1.12 linux/amd64
3:49:31 PM: Installing missing commands
3:49:31 PM: Verify run directory
3:49:31 PM: Executing user command: mvnw clean install
3:49:31 PM: /usr/local/bin/build: line 45: mvnw: command not found
3:49:31 PM: Skipping functions preparation step: no functions directory set
3:49:31 PM: Caching artifacts
3:49:31 PM: Started saving pip cache
3:49:31 PM: Finished saving pip cache
3:49:31 PM: Started saving emacs cask dependencies
3:49:31 PM: Finished saving emacs cask dependencies
3:49:31 PM: Started saving maven dependencies
3:49:31 PM: Finished saving maven dependencies
3:49:31 PM: Started saving boot dependencies
3:49:31 PM: Finished saving boot dependencies
3:49:31 PM: Started saving go dependencies
3:49:31 PM: Finished saving go dependencies
3:49:35 PM: Error running command: Build script returned non-zero exit code: 127
3:49:35 PM: Failing build: Failed to build site
3:49:36 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 127
3:49:36 PM: Finished processing build request in 16.135284854s

Hello @Vas, I don’t think we have maven installed in the buildbot by default. You can see that here: https://github.com/netlify/build-image/blob/xenial/Dockerfile. You’ll need to make sure you provide the binary for maven yourself so you can use it in the build-image.

Hope that helps.

To expand on Dennis suggestion, the usual pattern folks use for this is to get a binary for your build-image version (likely ubuntu 16.04), x86_64 architecture. Commit it to your repo and then running it like this:

chmod a+x ./mvnw && ./mvnw clean install

That will be the smoothest workflow I can recommend that will get you building immediately.

Another option is that we could consider adding it to our build image which is a possibility (but won’t be a quick update in any circumstance - usual path is to PR the addition as mentioned here; https://github.com/netlify/build-image#contributing)

Thank you for the answers :slight_smile:

What I have changed according to the advices:

I get the info that the build was successfull and the correct branch has been published, but I can not see the page (“Page not found”). I’ve had to delete the base directory from the configuration as I got with “dist/car-rental” the info that the directory does not exist - and unfortunately there were no informations for maven.

12:41:52 PM: [INFO] ---------------

12:41:52 PM: ---------------------------------------------------------

12:41:52 PM: [I

12:41:52 PM: NFO] BUILD SUCCESS

12:41:52 PM: [INFO] ------

12:41:52 PM: ------------------------------------------------------------------

12:41:52 PM: [INFO] Total time: 40.748

12:41:52 PM: s

12:41:52 PM: [INFO] Finished at:

12:41:52 PM: 2020-05-06T10:41

12:41:52 PM: :52Z

12:41:52 PM: [IN

12:41:52 PM: FO] ------------------------------------------------------------------------

12:41:52 PM: Skipping functions preparation step: no functions directory set

12:41:52 PM: Caching artifacts

12:41:52 PM: Started saving pip cache

12:41:52 PM: Finished saving pip cache

12:41:52 PM: Started saving emacs cask dependencies

12:41:52 PM: Finished saving emacs cask dependencies

12:41:52 PM: Started saving maven dependencies

12:41:53 PM: Finished saving maven dependencies

12:41:53 PM: Started saving boot dependencies

12:41:53 PM: Finished saving boot dependencies

12:41:53 PM: Started saving go dependencies

12:41:53 PM: Finished saving go dependencies

12:41:57 PM: Build script success

12:41:57 PM: Starting to deploy site from ‘’

12:41:57 PM: Creating deploy tree

12:41:58 PM: 7 new files to upload

12:41:58 PM: 0 new functions to upload

12:42:02 PM: Starting post processing

12:42:03 PM: Post processing done

12:42:03 PM: Site is live

12:42:30 PM: Finished processing build request in 1m37.038777863s

Hi there,

Did you see this guide yet? This is the best place to start for “Page Not Found” issues.

If you are still seeing issues after following the troubleshooting steps in this guide, please let us know!