Forge Home


Apache Maven module for Puppet


655,717 latest version

4.9 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.4.0 (latest)
  • 1.3.0
  • 1.2.2
  • 1.2.1
  • 1.2.0
  • 1.1.12
  • 1.1.11
  • 1.1.10
  • 1.1.9
  • 1.1.8
  • 1.1.7
  • 1.1.6
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0
  • 0.0.2
  • 0.0.1
released Jan 29th 2015
This version is compatible with:
  • Puppet Enterprise >=3.2.0
  • Puppet >=3.0.0
  • , , , , , , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'maestrodev-maven', '1.4.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add maestrodev-maven
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install maestrodev-maven --version 1.4.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Tags: apache, maven


maestrodev/maven — version 1.4.0 Jan 29th 2015


A Puppet recipe for Apache Maven, to download artifacts from a Maven repository

Uses Apache Maven command line to download the artifacts.

Building and Installing the Module

To build the module for installing in your Puppet master:

gem install puppet-module
git clone git://
cd puppet-maven
puppet module build
puppet module install pkg/maestrodev-maven-1.0.1.tar.gz

Of course, you can also clone the repository straight into /etc/puppet/modules/maven as well.

Developing and Testing the Module

If you are developing the module, it can be built using rake:

gem install bundler
rake spec

Acceptance tests

Using Puppetlabs Beaker. To run the default Vagrant box in CentOS 6.5 just do

rake beaker

To run any other box, check the definitions at spec/acceptance/nodesets. For instance to run the tests with Docker in CentOS 6.5

BEAKER_set=centos-65-x64-docker rake beaker


  maven { "/tmp/myfile":
    id => "groupId:artifactId:version:packaging:classifier",
    repos => ["id::layout::",""],


  maven { "/tmp/myfile":
    groupid => "org.apache.maven",
    artifactid => "maven-core",
    version => "3.2.5",
    packaging => "jar",
    classifier => "sources",
    repos => ["id::layout::",""],


ensure may be one of two values:

  • present (the default) -- the specified maven artifact is downloaded when no file exists at path (or name if no path is specified.) This is probably makes sense when the specified maven artifact refers to a released (non-SNAPSHOT) artifact.
  • latest -- if value of version is a specific version, RELEASE, LATEST, or a SNAPSHOT the repository is queried for an updated artifact. If an updated artifact is found the file at path is replaced.

MAVEN_OPTS Precedence

Values set in maven_opts will be prepended to any existing MAVEN_OPTS value. This ensures that those already specified will win over those added in mavenrc.

If you would prefer these options to win, instead use:

  maven_opts        => "",
  mavenrc_additions => 'MAVEN_OPTS="$MAVEN_OPTS -Xmx1024m"



  $central = {
    id => "myrepo",
    username => "myuser",
    password => "mypassword",
    url => "",
    mirrorof => "external:*",      # if you want to use the repo as a mirror, see maven::settings below
  $proxy = {
    active => true, #Defaults to true
    protocol => 'http', #Defaults to 'http'
    host => '',
    username => 'myuser', #Optional if proxy does not require
    password => 'mypassword', #Optional if proxy does not require
    nonProxyHosts => '', #Optional, provides exceptions to the proxy

  # Install Maven
  class { "maven::maven":
    version => "3.2.5", # version to install
    # you can get Maven tarball from a Maven repository instead than from Apache servers, optionally with a user/password
    repo => {
      #url => "",
      #username => "",
      #password => "",
  } ->

  # Setup a .mavenrc file for the specified user
  maven::environment { 'maven-env' : 
      user => 'root',
      # anything to add to MAVEN_OPTS in ~/.mavenrc
      maven_opts => '-Xmx1384m',       # anything to add to MAVEN_OPTS in ~/.mavenrc
      maven_path_additions => "",      # anything to add to the PATH in ~/.mavenrc

  } ->

  # Create a settings.xml with the repo credentials
  maven::settings { 'maven-user-settings' :
    mirrors => [$central], # mirrors entry in settings.xml, uses id, url, mirrorof from the hash passed
    servers => [$central], # servers entry in settings.xml, uses id, username, password from the hash passed
    proxies => [$proxy], # proxies entry in settings.xml, active, protocol, host, username, password, nonProxyHosts
    user    => 'maven',

  # defaults for all maven{} declarations
  Maven {
    user  => "maven", # you can make puppet run Maven as a specific user instead of root, useful to share Maven settings and local repository
    group => "maven", # you can make puppet run Maven as a specific group
    repos => ""

Downloading artifacts

  maven { "/tmp/maven-core-3.2.5.jar":
    id => "org.apache.maven:maven-core:3.2.5:jar",
    repos => ["central::default::",""],

  maven { "/tmp/maven-core-3.2.5-sources.jar":
    groupid    => "org.apache.maven",
    artifactid => "maven-core",
    version    => "3.2.5",
    classifier => "sources",

Buildr version

Initially there was an Apache Buildr version, but it required to have Buildr installed before running Puppet and you would need to enable pluginsync in both master and clients.


  Copyright 2011-2012 MaestroDev

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  See the License for the specific language governing permissions and
  limitations under the License.


Carlos Sanchez MaestroDev 2010-03-01