maven Cookbook

Cookbook Version (opens in a new tab) CI State (opens in a new tab) OpenCollective OpenCollective License (opens in a new tab)

Install and configure Apache Maven from the binaries provided by the Maven project.

Provides the maven resource for pulling a maven artifact from a maven repository and placing it in an arbitrary location.

Note: This cookbook does not handle the installation of Java but does require it to be installed. This can be done either using the Java cookbook (opens in a new tab) or your own cookbook. Check the Maven website (opens in a new tab) for more information about explicit Java requirements.


This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit (opens in a new tab) or come chat with us on the Chef Community Slack in #sous-chefs (opens in a new tab).



  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle
  • Fedora
  • Windows


  • Chef 13+


  • ark - used to unpack the maven tarball


  • node['maven']['version'] - specifies the version of maven to install.
  • node['maven']['m2_home'] - defaults to '/usr/local/maven/'
  • node['maven']['url'] - the download url for maven
  • node['maven']['checksum'] - the checksum, which you will have to recalculate if you change the download url using shasum -a 256 FILENAME
  • node['maven']['repositories'] - an array of maven repositories to use; must be specified as an array. Used in the maven LWRP.
  • node['maven']['setup_bin'] - whether or not to put mvn on your system path, defaults to false
  • node['maven']['mavenrc']['opts'] - value of MAVEN_OPTS environment variable exported via /etc/mavenrc template, defaults to -Dmaven.repo.local=$HOME/.m2/repository -Xmx384m
  • node['maven']['user'] - User to own Maven install, defaults to root or Administrator depending on platform.
  • node['maven']['group'] - Group to own Maven install, defaults to root or Administrators depending on platform.



Installs maven according to the version specified by the node['maven']['version'] attribute.


Installs gems required to parse settings.xml to ruby and hash and back to xml


Install a version of Java JRE (Oracle or OpenJDK) that is at minimum the version of Java required by the maven release you are installing (opens in a new tab). This can be done either using the Java cookbook (opens in a new tab) or your own cookbook.

Include the recipe where you want Apache Maven installed.

The maven lwrp has two actions, :install and :put. They are essentially the same accept that the install action will name the the downloaded file artifact_id-version.packaging. For example, the mysql jar would be named mysql-5.1.19.jar.

Use the put action when you want to explicitly control the name of the downloaded file. This is useful when you download an artifact and then want to have Chef resources act on files within that the artifact. The put action will creat a file named name.packaging where name corresponds to the name attribute.



This project exists thanks to all the people who contribute. (opens in a new tab)


Thank you to all our backers!


Support this project by becoming a sponsor. Your logo will show up here with a link to your website.