Adding Maven to the image with Oracle's JDK



I’m using Oracle’s JDK like this:

      # specify the version you desire here
      - image: circleci/jdk8:0.1.1

and I just switched from Gradle to Maven and now I’m finding this error:

/bin/bash: mvn: command not found
Exited with code 127

How do I install maven on this image?


I’m not familiar with Java or Maven, but I’ll take a guess that this image is based on Ubuntu. If it’s an Oracle flavour of Linux, swap out the package manager binary accordingly!

Add a run step thus:

apt-get install maven

That will get you the distro default version. If you want something more recent, head over to the Maven website and check out their install instructions.


Yeah, I had to run apt-get update first for it to work. And it takes a while (not sure if it’ll take a while in future runs).


You can always try building a custom image containing both the base image plus Maven on top, push it to a registry, then pull it when you need it. It depends whether installing or pulling is quicker.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.