A puppet recipe for Apache Maven, to download artifacts from a Maven repository
Ruby Puppet
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit ahead, 171 commits behind maestrodev:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/puppet
manifests
templates
tests
.gitignore
Modulefile
README.rdoc

README.rdoc

Copyright 2011 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

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Carlos Sanchez <csanchez@maestrodev.com> MaestroDev 2010-03-01


Puppet-Maven

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

Uses Apache Maven command line to download the artifacts.

Usage

maven { "/tmp/myfile":
  id => "groupId:artifactId:version:packaging:classifier",
  repos => ["id::layout::http://repo.acme.com","http://repo2.acme.com"],
}

or

maven { "/tmp/myfile":
  groupid => "org.apache.maven",
  artifactid => "maven-core",
  version => "2.2.1",
  packaging => "jar",
  classifier => "sources",
  repos => ["id::layout::http://repo.acme.com","http://repo2.acme.com"],
}

Examples

Setup

$repo1 = {
  id => "myrepo",
  username => "myuser",
  password => "mypassword",
  url => "http://repo.acme.com",
  mirrorof => "external:*",      # if you want to use the repo as a mirror, see maven::settings below
}

# Install Maven
class { "maven::maven":
  version => "2.2.1", # version to install
  # you can get Maven tarball from a Maven repository instead than from Apache servers, optionally with a user/password
  repo => {
    #url => "http://repo1.maven.org/maven2",
    #username => "",
    #password => "",
  },
  user                => "root",  # if you want to run it as a different user (defaults to root), will create it if not defined
  home                => "/root", # home directory of the user
  user_system         => true,    # make the user a system user
  maven_opts          => "",      # anything to add to MAVEN_OPTS in ~/.mavenrc
  maven_path_aditions => "",      # anything to add to the PATH in ~/.mavenrc
} ->

# Create a settings.xml with the repo credentials
class { "maven::settings" :
  mirrors => [$repo1], # mirrors entry in settings.xml, uses id, url, mirrorof from the hash passed
  servers => [$repo1], # servers entry in settings.xml, uses id, username, password from the hash passed
}

# 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 => "http://repo1.maven.apache.org/maven2"
}

Downloading artifacts

maven { "/tmp/maven-core-2.2.1.jar":
  id => "org.apache.maven:maven-core:2.2.1:jar",
  repos => ["central::default::http://repo1.maven.apache.org/maven2","http://mirrors.ibiblio.org/pub/mirrors/maven2"],
}

maven { "/tmp/maven-core-2.2.1-sources.jar":
  groupid    => "org.apache.maven",
  artifactid => "maven-core",
  version    => "2.2.1",
  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